1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 14:41:39 +00:00

PyInstaller is fucked up. Moved to cxFreeze.

This commit is contained in:
Virgil Dupras
2010-04-07 16:30:04 +01:00
parent e6486e08ab
commit 5573352ce6
10 changed files with 56 additions and 245 deletions

View File

@@ -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: