From bced5172d248f158b0f9cf0fbdb1f1933cf14bea Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Thu, 1 Dec 2022 18:05:55 +0000 Subject: [PATCH] single spec for one file/folder --- .github/workflows/build.yml | 2 +- src/gam.spec | 88 +++++++++++++++++++++++++------------ 2 files changed, 62 insertions(+), 28 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c08bb9a2..925059d3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -102,7 +102,7 @@ jobs: path: | bin.tar.xz src/cpython - key: gam-${{ matrix.jid }}-20221101 + key: gam-${{ matrix.jid }}-20221201 - name: Untar Cache archive if: matrix.goal == 'build' && steps.cache-python-ssl.outputs.cache-hit == 'true' diff --git a/src/gam.spec b/src/gam.spec index 8c452feb..c5cc802f 100644 --- a/src/gam.spec +++ b/src/gam.spec @@ -1,5 +1,7 @@ # -*- mode: python ; coding: utf-8 -*- +from os import getenv from sys import platform + from PyInstaller.utils.hooks import copy_metadata @@ -46,31 +48,63 @@ match platform: case _: target_arch = None strip = True -exe = EXE( - pyz, - a.scripts, - [], - exclude_binaries=True, - name='gam', - debug=False, - bootloader_ignore_signals=False, - strip=strip, - upx=False, - console=True, - disable_windowed_traceback=False, - argv_emulation=False, - target_arch=target_arch, - codesign_identity=None, - entitlements_file=None, -) -coll = COLLECT( - exe, - a.binaries, - a.zipfiles, - a.datas, - strip=strip, - upx=False, - upx_exclude=[], - name='gam', -) +name = 'gam' +debug = False +bootloader_ignore_signals = False +upx = False +console = True +disable_windowed_traceback = False +argv_emulation = False +codesign_identity = None +entitlements_file = None +if getenv('PYINSTALLER_BUILD_ONEFILE') == 'yes': + # Build one file + exe = EXE( + pyz, + a.scripts, + a.binaries, + a.zipfiles, + a.datas, + [], + name=name, + debug=debug, + bootloader_ignore_signals=bootloader_ignore_signals, + strip=strip, + upx=upx, + console=console, + disable_windowed_traceback=disable_windowed_traceback, + argv_emulation=argv_emulation, + target_arch=target_arch, + codesign_identity=codesign_identity, + entitlements_file=entitlements_file, + ) +else: + # Build one folder + exe = EXE( + pyz, + a.scripts, + [], + exclude_binaries=True, + name=name, + debug=debug, + bootloader_ignore_signals=bootloader_ignore_signals, + strip=strip, + upx=upx, + console=console, + disable_windowed_traceback=disable_windowed_traceback, + argv_emulation=argv_emulation, + target_arch=target_arch, + codesign_identity=codesign_identity, + entitlements_file=entitlements_file, + ) + coll = COLLECT( + exe, + a.binaries, + a.zipfiles, + a.datas, + strip=strip, + upx=upx, + upx_exclude=[], + name=name, + )