Skip to content

Commit

Permalink
add pyinstaller spec file
Browse files Browse the repository at this point in the history
  • Loading branch information
Joe Han committed Aug 3, 2023
1 parent ad3d4e9 commit a51b896
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ MANIFEST
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# *.spec

# Installer logs
pip-log.txt
Expand Down
49 changes: 49 additions & 0 deletions ProxyControl.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# FILEPATH: c:\Workspace\python\ladder\ProxyControl.spec

import os
from pathlib import Path
from PyInstaller.utils.hooks import collect_data_files

# Get the path of the assets folder
assets_path = str(Path('App', 'assets'))

# Collect all the .ico files in the assets folder
data_files = collect_data_files(assets_path, include_py_files=False)

# Add the .ico files to the list of data files
for root, _, files in os.walk(assets_path):
for file in files:
if file.endswith('.ico'):
data_files.append((os.path.join(root, file), root))

# Define the PyInstaller spec file
a = Analysis(['main.py'],
pathex=[],
binaries=[],
datas=data_files,
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=None,
noarchive=False)
pyz = PYZ(a.pure, a.zipped_data,
cipher=None)
exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='ProxyControl',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
upx_exclude=[],
upx_include=[],
runtime_tmpdir=None,
console=False,
icon='App\\assets\\di.ico' )

0 comments on commit a51b896

Please sign in to comment.