Skip to content

Commit

Permalink
Issue civictechdc#70: disable pyinstaller strip for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
DeanEby committed Feb 8, 2025
1 parent e5da070 commit 8100230
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .github/workflows/build_exe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,21 @@ jobs:
move_command: move dist\mangotango.exe dist\mangotango_windows.exe
sha_command: pwsh -c "Get-FileHash -Algorithm SHA1 dist\mangotango_windows.exe | Format-Table Hash -HideTableHeaders > dist\mangotango_windows.exe.sha1"
list_command: dir dist
installer_command: pyinstaller win_pyinstaller.spec
- platform_name: MacOS 14
artifact_name: macos-14
os: macos-14
move_command: mv dist/mangotango dist/mangotango_macos_14
sha_command: shasum -a 1 dist/mangotango_macos_14 > dist/mangotango_macos_14.sha1
list_command: ls -ll dist
installer_command: pyinstaller mac_pyinstaller.spec
- platform_name: MacOS 15
artifact_name: macos-15
os: macos-15
move_command: mv dist/mangotango dist/mangotango_macos_15
sha_command: shasum -a 1 dist/mangotango_macos_15 > dist/mangotango_macos_15.sha1
list_command: ls -ll dist
installer_command: pyinstaller mac_pyinstaller.spec

name: Build ${{ matrix.platform_name }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -77,7 +80,7 @@ jobs:

- name: Build the executable
run: |
pyinstaller pyinstaller.spec
${{ matrix.installer_command }}
- name: Rename the executable to include platform suffix
run: ${{ matrix.move_command }}
Expand Down
File renamed without changes.
49 changes: 49 additions & 0 deletions win_pyinstaller.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# main.spec
# This file tells PyInstaller how to bundle your application

from PyInstaller.utils.hooks import copy_metadata

block_cipher = None

a = Analysis(
['mangotango.py'], # Entry point
pathex=['.'], # Ensure all paths are correctly included
binaries=[],
datas=[
# version file, if defined
*(
[('./VERSION', '.')]
if os.path.exists('VERSION') else []
),

# inquirer depends on readchar as a hidden dependency that requires package metadata
*copy_metadata('readchar'),

# static assets for web servers
('./app/web_static', 'app/web_static'),
('./app/web_templates', 'app/web_templates')
],
hiddenimports=[
'readchar',
'numpy',
'numpy.core.multiarray'
], # Include any imports that PyInstaller might miss
hookspath=[],
runtime_hooks=[],
excludes=[]
)

pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)

exe = EXE(
pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
name='mangotango', # The name of the executable
debug=False,
strip=False,
upx=True, # You can set this to False if you don’t want UPX compression
console=True # Set to False if you don't want a console window
)

0 comments on commit 8100230

Please sign in to comment.