liuyuqi-cnb 1 day ago
parent
commit
d64e90f18b
4 changed files with 99 additions and 7 deletions
  1. 2 7
      .github/workflows/build-windows.yml
  2. 3 0
      .gitignore
  3. 47 0
      gui.spec
  4. 47 0
      main.spec

+ 2 - 7
.github/workflows/build-windows.yml

@@ -30,18 +30,13 @@ jobs:
         pip install -r requirements.txt
         pip install pyinstaller
         
-    - name: Create data directory structure
-      shell: pwsh
-      run: |
-        New-Item -ItemType Directory -Path "dist\data" -Force | Out-Null
-        Copy-Item data\a.csv dist\data\
-        Copy-Item data\b.csv dist\data\
-        
     - name: Build GUI executable
+      shell: pwsh
       run: |
         pyinstaller --clean --noconfirm gui.spec
         
     - name: Build CLI executable
+      shell: pwsh
       run: |
         pyinstaller --clean --noconfirm main.spec
         

+ 3 - 0
.gitignore

@@ -32,6 +32,9 @@ MANIFEST
 #  before PyInstaller builds the exe, so as to inject date/other infos into it.
 *.manifest
 *.spec
+# Exception: Keep build configuration spec files
+!gui.spec
+!main.spec
 
 # Installer logs
 pip-log.txt

+ 47 - 0
gui.spec

@@ -0,0 +1,47 @@
+# -*- mode: python ; coding: utf-8 -*-
+
+block_cipher = None
+
+a = Analysis(
+    ['gui.py'],
+    pathex=[],
+    binaries=[],
+    datas=[
+        ('data/a.csv', 'data'),
+        ('data/b.csv', 'data'),
+    ],
+    hiddenimports=[],
+    hookspath=[],
+    hooksconfig={},
+    runtime_hooks=[],
+    excludes=[],
+    win_no_prefer_redirects=False,
+    win_private_assemblies=False,
+    cipher=block_cipher,
+    noarchive=False,
+)
+
+pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
+
+exe = EXE(
+    pyz,
+    a.scripts,
+    a.binaries,
+    a.zipfiles,
+    a.datas,
+    [],
+    name='searchdomain_gui',
+    debug=False,
+    bootloader_ignore_signals=False,
+    strip=False,
+    upx=True,
+    upx_exclude=[],
+    runtime_tmpdir=None,
+    console=False,
+    disable_windowed_traceback=False,
+    argv_emulation=False,
+    target_arch=None,
+    codesign_identity=None,
+    entitlements_file=None,
+    icon=None,
+)

+ 47 - 0
main.spec

@@ -0,0 +1,47 @@
+# -*- mode: python ; coding: utf-8 -*-
+
+block_cipher = None
+
+a = Analysis(
+    ['main.py'],
+    pathex=[],
+    binaries=[],
+    datas=[
+        ('data/a.csv', 'data'),
+        ('data/b.csv', 'data'),
+    ],
+    hiddenimports=[],
+    hookspath=[],
+    hooksconfig={},
+    runtime_hooks=[],
+    excludes=[],
+    win_no_prefer_redirects=False,
+    win_private_assemblies=False,
+    cipher=block_cipher,
+    noarchive=False,
+)
+
+pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
+
+exe = EXE(
+    pyz,
+    a.scripts,
+    a.binaries,
+    a.zipfiles,
+    a.datas,
+    [],
+    name='searchdomain_cli',
+    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,
+    icon=None,
+)