From a8203baa50eb873157851da794f5e744e30d2466 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Wed, 6 Jan 2021 09:20:10 -0500 Subject: [PATCH] another attempt at arm64 MacOS support --- .github/actions/macos-install.sh | 17 +++++++----- src/gam-universal2.spec | 46 ++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 src/gam-universal2.spec diff --git a/.github/actions/macos-install.sh b/.github/actions/macos-install.sh index 652f4a5f..f2ebeb64 100755 --- a/.github/actions/macos-install.sh +++ b/.github/actions/macos-install.sh @@ -4,14 +4,19 @@ echo "Xcode versionn:" xcodebuild -version export gampath=dist/gam rm -rf $gampath -$python -OO -m PyInstaller --clean --noupx --strip -F --distpath $gampath gam.spec -export gam="$gampath/gam" +if [ "$PLATFORM" == "x86_64" ]; then + export specfile="gam.spec" +else + export specfile="gam-universal2.spec" +fi +$python -OO -m PyInstaller --clean --noupx --strip -F --distpath "${gampath}" "${specfile}" +export gam="${gampath}/gam" $gam version extended export GAMVERSION=`$gam version simple` -cp LICENSE $gampath -cp GamCommands.txt $gampath +cp LICENSE "${gampath}" +cp GamCommands.txt "${gampath}" MACOSVERSION=$(defaults read loginwindow SystemVersionStampAsString) -GAM_ARCHIVE=gam-$GAMVERSION-$GAMOS-$PLATFORM-MacOS$MACOSVERSION.tar.xz -rm $gampath/lastupdatecheck.txt +GAM_ARCHIVE="gam-${GAMVERSION}-${GAMOS}-${PLATFORM}-MacOS${MACOSVERSION}.tar.xz" +rm "${gampath}/lastupdatecheck.txt" # tar will cd to dist/ and tar up gam/ tar -C dist/ --create --file $GAM_ARCHIVE --xz gam diff --git a/src/gam-universal2.spec b/src/gam-universal2.spec new file mode 100644 index 00000000..031c4b10 --- /dev/null +++ b/src/gam-universal2.spec @@ -0,0 +1,46 @@ +# -*- mode: python -*- + +import sys + +import importlib +from PyInstaller.utils.hooks import copy_metadata + +sys.modules['FixTk'] = None + +# dynamically determine where httplib2/cacerts.txt lives +proot = os.path.dirname(importlib.import_module('httplib2').__file__) +extra_files = [(os.path.join(proot, 'cacerts.txt'), 'httplib2')] + +extra_files += copy_metadata('google-api-python-client') +extra_files += [('cbcm-v1.1beta1.json', '.')] + +a = Analysis(['gam/__main__.py'], + hiddenimports=[], + hookspath=None, + excludes=['FixTk', 'tcl', 'tk', '_tkinter', 'tkinter', 'Tkinter'], + datas=extra_files, + runtime_hooks=None) + +for d in a.datas: + if 'pyconfig' in d[0]: + a.datas.remove(d) + break + + +pyz = PYZ(a.pure) +exe = EXE(pyz, + a.scripts, + a.binaries, + a.zipfiles, + a.datas, + name='gam', + debug=False, + strip=None, + upx=False, + console=True ) + +app = BUNDLE(exe, + name='gam.app', + icon=None, + bundle_identifier=None, + info_plist={'LSArchitecturePriority': 'arm64,x86_64'})