From 7c2a837c9d0a447829417ccecb8d1453c4bf5c67 Mon Sep 17 00:00:00 2001 From: Joey Payne Date: Sun, 27 Sep 2015 18:00:48 -0600 Subject: [PATCH] Changed GUI build to pyinstaller. --- build_mac.bash | 22 ++++++++++++++-------- command_line.py | 8 +++++++- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/build_mac.bash b/build_mac.bash index e8c3729..231a4d9 100755 --- a/build_mac.bash +++ b/build_mac.bash @@ -7,16 +7,22 @@ cp -rf files Web2ExeMac-CMD/files/ rm -rf build dist Web2Executable.app -sudo python build_mac_setup.py py2app --iconfile icon.icns +#sudo python build_mac_setup.py py2app --iconfile icon.icns +pyinstaller -w --hidden-import PIL.Jpeg2KImagePlugin --hidden-import PyQt4 --hidden-import configobj --hidden-import pkg_resources --distpath Web2ExeMac --onefile -n Web2Executable main.py -sudo chown -R joey dist/Web2Executable.app -sudo chown -R joey dist/ build/ -mv dist/Web2Executable.app Web2Executable.app +#sudo chown -R joey dist/Web2Executable.app +#sudo chown -R joey dist/ build/ +#mv dist/Web2Executable.app Web2Executable.app -rm -rf Web2Executable.app/Contents/Frameworks/QtDesigner* -rm -rf Web2Executable.app/Contents/Frameworks/QtXml* -rm -rf Web2Executable.app/Contents/Frameworks/QtWebKit* -rm -rf Web2Executable.app/Contents/Frameworks/QtScript* +mv Web2ExeMac/Web2Executable.app . + +#rm -rf Web2Executable.app/Contents/Frameworks/QtDesigner* +#rm -rf Web2Executable.app/Contents/Frameworks/QtXml* +#rm -rf Web2Executable.app/Contents/Frameworks/QtWebKit* +#rm -rf Web2Executable.app/Contents/Frameworks/QtScript* + +cp icon.icns Web2Executable.app/Contents/Resources/icon-windowed.icns +cp -rf files Web2Executable.app/Contents/MacOS/ rm -rf build dist diff --git a/command_line.py b/command_line.py index 0efdff4..089c4e6 100644 --- a/command_line.py +++ b/command_line.py @@ -42,11 +42,17 @@ from configobj import ConfigObj inside_packed_exe = getattr(sys, 'frozen', '') -CWD = os.getcwd() +if inside_packed_exe: + # we are running in a |PyInstaller| bundle + CWD = os.path.dirname(sys.executable) +else: + # we are running in a normal Python environment + CWD = os.getcwd() def get_file(path): parts = path.split('/') independent_path = os.path.join(CWD, *parts) + print independent_path return independent_path TEMP_DIR = get_temp_dir()