From 5573352ce6d09d27f8c45f8b1299f3ed128ea04a Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Wed, 7 Apr 2010 16:30:04 +0100 Subject: [PATCH] PyInstaller is fucked up. Moved to cxFreeze. --- package.py | 34 +++++------- qt/base/cxfreeze_fix.py | 5 ++ qt/me/dgme.spec | 19 ------- qt/me/verinfo | 28 ---------- qt/pe/dgpe.spec | 19 ------- qt/pe/installer.aip | 116 +++++++++++++--------------------------- qt/pe/start.py | 3 +- qt/pe/verinfo | 28 ---------- qt/se/dgse.spec | 21 -------- qt/se/verinfo | 28 ---------- 10 files changed, 56 insertions(+), 245 deletions(-) create mode 100644 qt/base/cxfreeze_fix.py delete mode 100644 qt/me/dgme.spec delete mode 100644 qt/me/verinfo delete mode 100644 qt/pe/dgpe.spec delete mode 100644 qt/pe/verinfo delete mode 100644 qt/se/dgse.spec delete mode 100644 qt/se/verinfo diff --git a/package.py b/package.py index ecfd0e1e..07decb08 100644 --- a/package.py +++ b/package.py @@ -25,7 +25,7 @@ def package_cocoa(edition): }[edition] build_dmg(app_path, '.') -def package_windows(edition): +def package_windows(edition, with_upx=True): # On Windows, PyInstaller is used to build an exe (py2exe creates a very bad looking icon) # The release version is outdated. Use at least r672 on http://svn.pyinstaller.org/trunk if sys.platform != "win32": @@ -37,30 +37,25 @@ def package_windows(edition): os.chdir(op.join('qt', edition)) from app import DupeGuru - # Removing build and dist - if op.exists('build'): - shutil.rmtree('build') if op.exists('dist'): shutil.rmtree('dist') - version = DupeGuru.VERSION - versioncomma = version.replace('.', ', ') + ', 0' - verinfo = open('verinfo').read() - verinfo = verinfo.replace('$versioncomma', versioncomma).replace('$version', version) - fp = open('verinfo_tmp', 'w') - fp.write(verinfo) - fp.close() - print_and_do("python C:\\Python26\\pyinstaller\\Build.py dg{0}.spec".format(edition)) - os.remove('verinfo_tmp') + + cmd = 'cxfreeze --base-name Win32GUI --target-name "{0}.exe" --icon {1} start.py' + target_name = {'se': 'dupeGuru', 'me': 'dupeGuru ME', 'pe': 'dupeGuru PE'}[edition] + icon_path = '..\\..\\images\\dg{0}_logo.ico'.format(edition) + print_and_do(cmd.format(target_name, icon_path)) + + if with_upx: + libs = [name for name in os.listdir('dist') if op.splitext(name)[1] in ('.pyd', '.dll', '.exe')] + for lib in libs: + print_and_do("upx --best \"dist\\{0}\"".format(lib)) - print_and_do("del dist\\*90.dll") # They're in vcredist, no need to include them - print_and_do("del dist\\POWRPROF.dll") # no need of that crap - print_and_do("del dist\\SHLWAPI.dll") # no need of that crap print_and_do("xcopy /Y /S /I ..\\..\\help_{0}\\dupeguru_{0}_help dist\\help".format(edition)) # AdvancedInstaller.com has to be in your PATH # this is so we don'a have to re-commit installer.aip at every version change shutil.copy('installer.aip', 'installer_tmp.aip') - print_and_do('AdvancedInstaller.com /edit installer_tmp.aip /SetVersion %s' % version) + print_and_do('AdvancedInstaller.com /edit installer_tmp.aip /SetVersion %s' % DupeGuru.VERSION) print_and_do('AdvancedInstaller.com /build installer_tmp.aip -force') os.remove('installer_tmp.aip') os.chdir(op.join('..', '..')) @@ -104,15 +99,12 @@ def main(): edition = conf['edition'] ui = conf['ui'] dev = conf['dev'] - if dev: - print "You can't package in dev mode" - return print "Packaging dupeGuru {0} with UI {1}".format(edition.upper(), ui) if ui == 'cocoa': package_cocoa(edition) elif ui == 'qt': if sys.platform == "win32": - package_windows(edition) + package_windows(edition, with_upx=not dev) elif sys.platform == "linux2": package_debian(edition) else: diff --git a/qt/base/cxfreeze_fix.py b/qt/base/cxfreeze_fix.py new file mode 100644 index 00000000..e715499c --- /dev/null +++ b/qt/base/cxfreeze_fix.py @@ -0,0 +1,5 @@ +# cxfreeze has some problems detecting all dependencies. +# This modules explicitly import those problematic modules. + +import lxml._elementpath +import gzip \ No newline at end of file diff --git a/qt/me/dgme.spec b/qt/me/dgme.spec deleted file mode 100644 index 0e21463b..00000000 --- a/qt/me/dgme.spec +++ /dev/null @@ -1,19 +0,0 @@ -# -*- mode: python -*- -a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'), os.path.join(HOMEPATH,'support\\useUnicode.py'), 'start.py'], - pathex=[]) -pyz = PYZ(a.pure) -exe = EXE(pyz, - a.scripts, - exclude_binaries=1, - name=os.path.join('build\\pyi.win32\\dupeGuru ME', 'dupeGuru ME.exe'), - debug=False, - strip=False, - upx=True, - console=False , icon='..\\..\\images\\dgme_logo.ico', version='verinfo_tmp') -coll = COLLECT( exe, - a.binaries, - a.zipfiles, - a.datas, - strip=False, - upx=True, - name=os.path.join('dist')) diff --git a/qt/me/verinfo b/qt/me/verinfo deleted file mode 100644 index 6384c49e..00000000 --- a/qt/me/verinfo +++ /dev/null @@ -1,28 +0,0 @@ -VSVersionInfo( - ffi=FixedFileInfo( - filevers=($versioncomma), - prodvers=($versioncomma), - mask=0x17, - flags=0x0, - OS=0x4, - fileType=0x1, - subtype=0x0, - date=(0, 0) - ), - kids=[ - StringFileInfo( - [ - StringTable( - '040904b0', - [StringStruct('CompanyName', 'Hardcoded Software'), - StringStruct('FileDescription', 'dupeGuru Music Edition'), - StringStruct('FileVersion', '$version'), - StringStruct('InternalName', 'dupeGuru ME.exe'), - StringStruct('LegalCopyright', '(c) Hardcoded Software. All rights reserved.'), - StringStruct('OriginalFilename', 'dupeGuru ME.exe'), - StringStruct('ProductName', 'dupeGuru Music Edition'), - StringStruct('ProductVersion', '$versioncomma')]) - ]), - VarFileInfo([VarStruct('Translation', [1033])]) - ] -) diff --git a/qt/pe/dgpe.spec b/qt/pe/dgpe.spec deleted file mode 100644 index ab00fde5..00000000 --- a/qt/pe/dgpe.spec +++ /dev/null @@ -1,19 +0,0 @@ -# -*- mode: python -*- -a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'), os.path.join(HOMEPATH,'support\\useUnicode.py'), 'start.py'], - pathex=[]) -pyz = PYZ(a.pure) -exe = EXE(pyz, - a.scripts, - exclude_binaries=1, - name=os.path.join('build\\pyi.win32\\dupeGuru PE', 'dupeGuru PE.exe'), - debug=False, - strip=False, - upx=True, - console=False , icon='..\\..\\images\\dgpe_logo.ico', version='verinfo_tmp') -coll = COLLECT( exe, - a.binaries, - a.zipfiles, - a.datas, - strip=False, - upx=True, - name=os.path.join('dist')) diff --git a/qt/pe/installer.aip b/qt/pe/installer.aip index 390693d8..d6d8f4a4 100644 --- a/qt/pe/installer.aip +++ b/qt/pe/installer.aip @@ -1,5 +1,5 @@ - + @@ -28,110 +28,65 @@ - - - - - - - - - + - - - - - - - - - - - - - - - - - + - - - - - - - - + + + + + - - - - - + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - - - - - - + @@ -261,6 +216,7 @@ + diff --git a/qt/pe/start.py b/qt/pe/start.py index dfedc359..6ef886ad 100644 --- a/qt/pe/start.py +++ b/qt/pe/start.py @@ -11,10 +11,11 @@ from PyQt4.QtCore import QCoreApplication from PyQt4.QtGui import QApplication, QIcon, QPixmap import base.dg_rc +import base.cxfreeze_fix from app import DupeGuru -# This is a workaround for a pyinstaller problem where compiled dupeguru can't read tiff files +# This is a workaround for a cxfreeze problem where compiled dupeguru can't read tiff files from PIL import TiffImagePlugin, TiffTags if __name__ == "__main__": diff --git a/qt/pe/verinfo b/qt/pe/verinfo deleted file mode 100644 index d70ee2a0..00000000 --- a/qt/pe/verinfo +++ /dev/null @@ -1,28 +0,0 @@ -VSVersionInfo( - ffi=FixedFileInfo( - filevers=($versioncomma), - prodvers=($versioncomma), - mask=0x17, - flags=0x0, - OS=0x4, - fileType=0x1, - subtype=0x0, - date=(0, 0) - ), - kids=[ - StringFileInfo( - [ - StringTable( - '040904b0', - [StringStruct('CompanyName', 'Hardcoded Software'), - StringStruct('FileDescription', 'dupeGuru Picture Edition'), - StringStruct('FileVersion', '$version'), - StringStruct('InternalName', 'dupeGuru PE.exe'), - StringStruct('LegalCopyright', '(c) Hardcoded Software. All rights reserved.'), - StringStruct('OriginalFilename', 'dupeGuru PE.exe'), - StringStruct('ProductName', 'dupeGuru Picture Edition'), - StringStruct('ProductVersion', '$versioncomma')]) - ]), - VarFileInfo([VarStruct('Translation', [1033])]) - ] -) diff --git a/qt/se/dgse.spec b/qt/se/dgse.spec deleted file mode 100644 index 7810d2e3..00000000 --- a/qt/se/dgse.spec +++ /dev/null @@ -1,21 +0,0 @@ -# -*- mode: python -*- -a = Analysis([os.path.join(HOMEPATH,'support\\_mountzlib.py'), os.path.join(HOMEPATH,'support\\useUnicode.py'), 'start.py'], - pathex=[]) -pyz = PYZ(a.pure) -exe = EXE(pyz, - a.scripts, - exclude_binaries=1, - name=os.path.join('build\\pyi.win32\\dupeGuru', 'dupeGuru.exe'), - debug=False, - strip=False, - upx=True, - console=False, - icon='..\\..\\images\\dgse_logo.ico', - version='verinfo_tmp') -coll = COLLECT( exe, - a.binaries, - a.zipfiles, - a.datas, - strip=False, - upx=True, - name=os.path.join('dist')) diff --git a/qt/se/verinfo b/qt/se/verinfo deleted file mode 100644 index b32801d5..00000000 --- a/qt/se/verinfo +++ /dev/null @@ -1,28 +0,0 @@ -VSVersionInfo( - ffi=FixedFileInfo( - filevers=($versioncomma), - prodvers=($versioncomma), - mask=0x17, - flags=0x0, - OS=0x4, - fileType=0x1, - subtype=0x0, - date=(0, 0) - ), - kids=[ - StringFileInfo( - [ - StringTable( - '040904b0', - [StringStruct('CompanyName', 'Hardcoded Software'), - StringStruct('FileDescription', 'dupeGuru'), - StringStruct('FileVersion', '$version'), - StringStruct('InternalName', 'dupeGuru.exe'), - StringStruct('LegalCopyright', '(c) Hardcoded Software. All rights reserved.'), - StringStruct('OriginalFilename', 'dupeGuru.exe'), - StringStruct('ProductName', 'dupeGuru'), - StringStruct('ProductVersion', '$versioncomma')]) - ]), - VarFileInfo([VarStruct('Translation', [1033])]) - ] -)