From 5af9eaa464f78b54bb369fefc96e7a5b4649b245 Mon Sep 17 00:00:00 2001
From: thnikk <thnikkshop@gmail.com>
Date: Fri, 6 Dec 2024 17:37:09 -0800
Subject: [PATCH] Use .spec file for pyinstaller

---
 .github/workflows/build.yml |  2 +-
 .gitignore                  |  3 +++
 pybar.spec                  | 47 +++++++++++++++++++++++++++++++++++++
 3 files changed, 51 insertions(+), 1 deletion(-)
 create mode 100644 pybar.spec

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 1d575f9..d39d3bc 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -30,7 +30,7 @@ jobs:
 
       - name: Build binary
         run: |
-          pyinstaller main.py --add-data="style.css:." --onefile --clean --noconfirm -n pybar
+          pyinstaller pybar.spec
 
       - name: Create Artifact
         uses: actions/upload-artifact@v4
diff --git a/.gitignore b/.gitignore
index c18dd8d..cb48281 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,4 @@
 __pycache__/
+build/
+dist/
+main.spec
diff --git a/pybar.spec b/pybar.spec
new file mode 100644
index 0000000..25f7c50
--- /dev/null
+++ b/pybar.spec
@@ -0,0 +1,47 @@
+# -*- mode: python ; coding: utf-8 -*-
+
+
+a = Analysis(
+    ['main.py'],
+    pathex=[],
+    binaries=[],
+    datas=[('style.css', '.')],
+    hiddenimports=[],
+    hookspath=[],
+    hooksconfig={
+        "gi": {
+            "themes": ["Adwaita"],
+            "icons": ["Adwaita"],
+            "languages": ["en_US"],
+            "module-versions": {
+                "Gtk": "3.0",
+            },
+        },
+    },
+    runtime_hooks=[],
+    excludes=[],
+    noarchive=False,
+    optimize=0,
+)
+pyz = PYZ(a.pure)
+
+exe = EXE(
+    pyz,
+    a.scripts,
+    a.binaries,
+    a.datas,
+    [],
+    name='pybar',
+    debug=False,
+    bootloader_ignore_signals=False,
+    strip=False,
+    upx=True,
+    upx_exclude=[],
+    runtime_tmpdir=None,
+    console=True,
+    disable_windowed_traceback=False,
+    argv_emulation=False,
+    target_arch=None,
+    codesign_identity=None,
+    entitlements_file=None,
+)