diff --git a/src/linux-gam.spec b/src/gam.spec similarity index 72% rename from src/linux-gam.spec rename to src/gam.spec index e7829233..0451f460 100644 --- a/src/linux-gam.spec +++ b/src/gam.spec @@ -2,23 +2,31 @@ import sys +import importlib +from PyInstaller.utils.hooks import copy_metadata + sys.modules['FixTk'] = None +extra_files = [('cloudprint-v2.json', 'cloudprint-v2.json')] + +# 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') + a = Analysis(['gam.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 -a.datas += [('cloudprint-v2.json', 'cloudprint-v2.json', 'DATA')] -# dynamically determine where httplib2/cacerts.txt lives -import importlib -proot = os.path.dirname(importlib.import_module('httplib2').__file__) -a.datas += [('httplib2/cacerts.txt', os.path.join(proot, 'cacerts.txt'), 'DATA')] pyz = PYZ(a.pure) exe = EXE(pyz, diff --git a/src/macos-gam.spec b/src/macos-gam.spec deleted file mode 100644 index 5f5532f5..00000000 --- a/src/macos-gam.spec +++ /dev/null @@ -1,32 +0,0 @@ -# -*- mode: python -*- -import sys - -sys.modules['FixTk'] = None - -a = Analysis(['gam.py'], - hiddenimports=[], - hookspath=None, - excludes=['FixTk', 'tcl', 'tk', '_tkinter', 'tkinter', 'Tkinter'], - runtime_hooks=None) -for d in a.datas: - if 'pyconfig' in d[0]: - a.datas.remove(d) - break -a.datas += [('cloudprint-v2.json', 'cloudprint-v2.json', 'DATA')] - -# dynamically determine where httplib2/cacerts.txt lives -import importlib -proot = os.path.dirname(importlib.import_module('httplib2').__file__) -a.datas += [('httplib2/cacerts.txt', os.path.join(proot, 'cacerts.txt'), 'DATA')] - -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 ) diff --git a/src/travis/linux-install.sh b/src/travis/linux-install.sh index 5f5b33db..df539fb9 100755 --- a/src/travis/linux-install.sh +++ b/src/travis/linux-install.sh @@ -3,7 +3,7 @@ if [[ "$TRAVIS_JOB_NAME" == *"Testing" ]]; then export gam="$python gam.py" export gampath=$(readlink -e .) else - $python -OO -m PyInstaller --clean --noupx --strip -F --distpath=gam $GAMOS-gam.spec + $python -OO -m PyInstaller --clean --noupx --strip -F --distpath=gam gam.spec export gam="gam/gam" export gampath=$(readlink -e gam) export GAMVERSION=`$gam version simple` diff --git a/src/travis/osx-install.sh b/src/travis/osx-install.sh index 63ab226d..37d95c61 100755 --- a/src/travis/osx-install.sh +++ b/src/travis/osx-install.sh @@ -1,7 +1,7 @@ cd src echo "MacOS Version Info According to Python:" python -c "import platform; print(platform.mac_ver())" -$python -OO -m PyInstaller --clean --noupx --strip -F --distpath=gam $GAMOS-gam.spec +$python -OO -m PyInstaller --clean --noupx --strip -F --distpath=gam gam.spec export gam="gam/gam" export gampath=gam $gam version extended diff --git a/src/travis/windows-install.sh b/src/travis/windows-install.sh index 14c6b37c..c4e2a06e 100755 --- a/src/travis/windows-install.sh +++ b/src/travis/windows-install.sh @@ -1,6 +1,6 @@ cd src echo "compiling GAM with pyinstaller..." -pyinstaller --clean --noupx -F --distpath=gam $GAMOS-gam.spec +pyinstaller --clean --noupx -F --distpath=gam gam.spec export gam="gam/gam" export gampath=$(readlink -e gam) echo "running compiled GAM..." diff --git a/src/windows-gam.spec b/src/windows-gam.spec deleted file mode 100644 index 873a79da..00000000 --- a/src/windows-gam.spec +++ /dev/null @@ -1,33 +0,0 @@ -# -*- mode: python -*- -import sys - -sys.modules['FixTk'] = None - -a = Analysis(['gam.py'], - pathex=['C:\\Users\\jlee\\Documents\\GitHub\\GAM'], - hiddenimports=[], - hookspath=None, - excludes=['FixTk', 'tcl', 'tk', '_tkinter', 'tkinter', 'Tkinter'], - runtime_hooks=None) -for d in a.datas: - if 'pyconfig' in d[0]: - a.datas.remove(d) - break -a.datas += [('cloudprint-v2.json', 'cloudprint-v2.json', 'DATA')] - -# dynamically determine where httplib2/cacerts.txt lives -import importlib -proot = os.path.dirname(importlib.import_module('httplib2').__file__) -a.datas += [('httplib2/cacerts.txt', os.path.join(proot, 'cacerts.txt'), 'DATA')] - -pyz = PYZ(a.pure) -exe = EXE(pyz, - a.scripts, - a.binaries, - a.zipfiles, - a.datas, - name='gam.exe', - debug=False, - strip=None, - upx=True, - console=True )