From a51b8965e5cd369650028d069d1d6f2bbee3ed90 Mon Sep 17 00:00:00 2001 From: Joe Han Date: Thu, 3 Aug 2023 14:02:46 +0800 Subject: [PATCH] add pyinstaller spec file --- .gitignore | 2 +- ProxyControl.spec | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 ProxyControl.spec diff --git a/.gitignore b/.gitignore index 0972533..a3249c8 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/ProxyControl.spec b/ProxyControl.spec new file mode 100644 index 0000000..b06fddd --- /dev/null +++ b/ProxyControl.spec @@ -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' )