diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f63ebbe7..a96953bd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -450,7 +450,7 @@ jobs: - name: Copy extra package files if: matrix.goal == 'build' run: | - cp -v roots.pem $gampath + #cp -v roots.pem $gampath cp -v LICENSE $gampath cp -v GamCommands.txt $gampath if [[ "${RUNNER_OS}" == "Windows" ]]; then @@ -515,9 +515,9 @@ jobs: GAM_ARCHIVE="../gam-${GAMVERSION}-windows-${GAM_ARCHIVE_ARCH}.zip" /c/Program\ Files/7-Zip/7z.exe a -tzip $GAM_ARCHIVE gam "-xr@${GITHUB_WORKSPACE}/.github/actions/package_exclusions.txt" -bb3 cd .. - /c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.11/bin/candle.exe -arch "${WIX_ARCH}" gam.wxs - /c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.11/bin/light.exe -ext /c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.11/bin/WixUIExtension.dll gam.wixobj -o "gam-${GAMVERSION}-windows-${GAM_ARCHIVE_ARCH}.msi" || true; - rm -v -f *.wixpdb + #/c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.11/bin/candle.exe -arch "${WIX_ARCH}" gam.wxs + #/c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.11/bin/light.exe -ext /c/Program\ Files\ \(x86\)/WiX\ Toolset\ v3.11/bin/WixUIExtension.dll gam.wixobj -o "gam-${GAMVERSION}-windows-${GAM_ARCHIVE_ARCH}.msi" || true; + #rm -v -f *.wixpdb - name: Basic Tests build jobs only if: matrix.goal != 'test' && steps.cache-python-ssl.outputs.cache-hit != 'true' diff --git a/src/gam.spec b/src/gam.spec index 2b9cec48..8c452feb 100644 --- a/src/gam.spec +++ b/src/gam.spec @@ -1,53 +1,76 @@ -# -*- mode: python -*- - -import sys - -import importlib +# -*- mode: python ; coding: utf-8 -*- +from sys import platform from PyInstaller.utils.hooks import copy_metadata -extra_files = [] +extra_files = [] extra_files += copy_metadata('google-api-python-client') extra_files += [('cbcm-v1.1beta1.json', '.')] extra_files += [('contactdelegation-v1.json', '.')] extra_files += [('admin-directory_v1.1beta1.json', '.')] - +extra_files += [('roots.pem', '.')] hidden_imports = [ 'gam.auth.yubikey', ] - -a = Analysis(['gam/__main__.py'], - hiddenimports=hidden_imports, - hookspath=None, - excludes=['FixTk', 'tcl', 'tk', '_tkinter', 'tkinter', 'Tkinter'], - datas=extra_files, - runtime_hooks=None) - +a = Analysis( + ['gam/__main__.py'], + pathex=[], + binaries=[], + datas=extra_files, + hiddenimports=hidden_imports, + hookspath=[], + hooksconfig={}, + runtime_hooks=[], + excludes=[], + win_no_prefer_redirects=False, + win_private_assemblies=False, + cipher=None, + noarchive=False, +) for d in a.datas: if 'pyconfig' in d[0]: a.datas.remove(d) break +pyz = PYZ(a.pure, + a.zipped_data, + cipher=None) +# requires Python 3.10+ but no one should be compiling +# GAM with older versions anyway +match platform: + case "darwin": + target_arch = "universal2" + strip = True + case "win32": + target_arch = None + strip = False + 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', +) - -pyz = PYZ(a.pure) - - -if sys.platform == "darwin": - target_arch="universal2" -else: - target_arch=None - -# use strip on all non-Windows platforms -strip = not sys.platform == 'win32' - -exe = EXE(pyz, - a.scripts, - a.binaries, - a.zipfiles, - a.datas, - name='gam', - debug=False, - strip=strip, - upx=False, - target_arch=target_arch, - console=True)