From 38c567369a400bbb54b9c905ba519a0f9ede3deb Mon Sep 17 00:00:00 2001 From: Rob McMullen Date: Fri, 1 Sep 2017 21:52:59 -0700 Subject: [PATCH] pyinstaller: added hook script for the future module * added debug option for windows builds that prints to console --- pyinstaller/OmnivoreXL.spec | 9 ++++++--- pyinstaller/build_pyinstaller.py | 12 +++++++++--- pyinstaller/hook-future.py | 7 +++++++ 3 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 pyinstaller/hook-future.py diff --git a/pyinstaller/OmnivoreXL.spec b/pyinstaller/OmnivoreXL.spec index 1d9cad92..3ab551d3 100644 --- a/pyinstaller/OmnivoreXL.spec +++ b/pyinstaller/OmnivoreXL.spec @@ -1,6 +1,7 @@ # -*- mode: python -*- block_cipher = None +DEBUG = False with open("../run.py", "r") as fh: script = fh.read() @@ -54,16 +55,18 @@ if sys.platform == "darwin": icon=icon) elif sys.platform == "win32": + upx = not DEBUG + console = DEBUG exe = EXE(pyz, a.scripts, a.binaries, a.zipfiles, a.datas, name='OmnivoreXL', - debug=False, + debug=DEBUG, strip=False, - upx=True, - console=False, + upx=upx, + console=console, icon="../omnivore/icons/omnivore.ico") diff --git a/pyinstaller/build_pyinstaller.py b/pyinstaller/build_pyinstaller.py index 1f9b16b7..118ebab5 100644 --- a/pyinstaller/build_pyinstaller.py +++ b/pyinstaller/build_pyinstaller.py @@ -5,6 +5,14 @@ from subprocess import Popen, PIPE if sys.platform == 'win32': + # On windows, you can disable installation of egg files by creating the + # file %HOMEPATH%/pydistutils.cfg + # + # pyinstaller 3.2 doesn't work with the 'future' library. Development + # branch was suggested because of a fix for: + # https://github.com/pyinstaller/pyinstaller/issues/1935 but it still + # doesn't work. There are dynamic imports that aren't being included, so I + # had to create hook-future.py to include those. win = True mac = False exe = ".exe" @@ -45,9 +53,7 @@ def run(args): dest_zip = "%s/%s" % (dest_dir, final_zip) print "Building %s" % build_app -args = ['pyinstaller', '-y', '--debug', '--windowed'] -if win: - args.append('--onefile') +args = ['pyinstaller', '-y'] args.append('%s.spec' % build_target) run(args) diff --git a/pyinstaller/hook-future.py b/pyinstaller/hook-future.py new file mode 100644 index 00000000..56e121ad --- /dev/null +++ b/pyinstaller/hook-future.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python +""" + Future has some dynamic imports that are not picked up + +""" + +hiddenimports = ['UserList', 'UserDict', 'UserString', 'itertools', 'stat', 'base64', 'commands']