diff --git a/package.py b/package.py index 3535e652..4a93c91e 100644 --- a/package.py +++ b/package.py @@ -13,6 +13,7 @@ import shutil import json from argparse import ArgumentParser import platform +import glob from hscommon.plat import ISWINDOWS, ISLINUX from hscommon.build import (add_to_pythonpath, print_and_do, copy_packages, build_debian_changelog, @@ -37,6 +38,7 @@ def package_windows(edition, dev): if not ISWINDOWS: print("Qt packaging only works under Windows.") return + from cx_Freeze import setup, Executable add_to_pythonpath('.') app_version = get_module_version('core_{}'.format(edition)) distdir = 'dist' @@ -44,38 +46,58 @@ def package_windows(edition, dev): if op.exists(distdir): shutil.rmtree(distdir) - is64bit = platform.architecture()[0] == '64bit' - # Since v4.2.3, cx_freeze started to falsely include tkinter in the package. We exclude it explicitly because of that. - cmd = 'cxfreeze --base-name Win32GUI --target-dir "{0}" --target-name "{1}.exe" --icon {2} --exclude-modules tkinter run.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(distdir, target_name, icon_path)) - if not dev: # Copy qt plugins - plugin_dest = op.join(distdir, 'qt4_plugins') + plugin_dest = distdir plugin_names = ['accessible', 'codecs', 'iconengines', 'imageformats'] copy_qt_plugins(plugin_names, plugin_dest) - - # Compress with UPX - if not is64bit: # UPX doesn't work on 64 bit - libs = [name for name in os.listdir(distdir) if op.splitext(name)[1] in ('.pyd', '.dll', '.exe')] - for lib in libs: - print_and_do("upx --best \"{0}\"".format(op.join(distdir, lib))) - + + # Since v4.2.3, cx_freeze started to falsely include tkinter in the package. We exclude it explicitly because of that. + options = { + 'build_exe': { + 'includes': 'atexit', + 'excludes': ['tkinter'], + 'bin_excludes': ['icudt51', 'icuin51.dll', 'icuuc51.dll'], + 'icon': 'images\\dg{0}_logo.ico'.format(edition), + 'include_msvcr': True, + }, + 'install_exe': { + 'install_dir': 'dist', + } + } + + executables = [ + Executable( + 'run.py', + base='Win32GUI', + targetDir=distdir, + targetName={'se': 'dupeGuru', 'me': 'dupeGuru ME', 'pe': 'dupeGuru PE'}[edition] + '.exe', + ) + ] + + setup( + script_args=['install'], + options=options, + executables=executables + ) + + print("Removing useless DLLs") + # Huge useless dll that appeared with Qt5 + for fn in glob.glob(op.join(distdir, 'icu*.dll')): + os.remove(fn) + # Debug info that cx_freeze brings in. + for fn in glob.glob(op.join(distdir, '*', '*.pdb')): + os.remove(fn) help_path = op.join('build', 'help') print("Copying {} to dist\\help".format(help_path)) shutil.copytree(help_path, op.join(distdir, 'help')) locale_path = op.join('build', 'locale') print("Copying {} to dist\\locale".format(locale_path)) shutil.copytree(locale_path, op.join(distdir, 'locale')) - # We don't install the VC redist as a prerequisite. We just bundle the appropriate dlls. - shutil.copy(find_in_path('msvcr100.dll'), distdir) - shutil.copy(find_in_path('msvcp100.dll'), distdir) # AdvancedInstaller.com has to be in your PATH # this is so we don'a have to re-commit installer.aip at every version change - installer_file = 'installer64.aip' if is64bit else 'installer.aip' + installer_file = 'installer.aip' installer_path = op.join('qt', edition, installer_file) shutil.copy(installer_path, 'installer_tmp.aip') print_and_do('AdvancedInstaller.com /edit installer_tmp.aip /SetVersion %s' % app_version) diff --git a/qt/base/cxfreeze_fix.py b/qt/base/cxfreeze_fix.py index e6a8a0b2..026da82a 100644 --- a/qt/base/cxfreeze_fix.py +++ b/qt/base/cxfreeze_fix.py @@ -5,5 +5,3 @@ import xml.etree.ElementPath import gzip import os - -os.environ['QT_PLUGIN_PATH'] = 'qt4_plugins' \ No newline at end of file diff --git a/qt/me/installer.aip b/qt/me/installer.aip index 67a2bb9d..f3fb76a7 100644 --- a/qt/me/installer.aip +++ b/qt/me/installer.aip @@ -21,8 +21,10 @@ - - + + + + @@ -33,19 +35,18 @@ + - - + - - + - + @@ -102,6 +103,9 @@ + + + @@ -110,29 +114,18 @@ - - + - - - - - - - - - - @@ -141,7 +134,8 @@ - + + @@ -153,7 +147,6 @@ - @@ -168,7 +161,4 @@ - - - diff --git a/qt/me/installer64.aip b/qt/me/installer64.aip deleted file mode 100644 index f3fb76a7..00000000 --- a/qt/me/installer64.aip +++ /dev/null @@ -1,164 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/qt/pe/installer.aip b/qt/pe/installer.aip index f6c2f2cc..16e5b7fd 100644 --- a/qt/pe/installer.aip +++ b/qt/pe/installer.aip @@ -21,8 +21,8 @@ - - + + @@ -35,18 +35,16 @@ - - + - - + - + @@ -112,29 +110,18 @@ - - + - - - - - - - - - - @@ -143,7 +130,7 @@ - + @@ -155,7 +142,6 @@ - @@ -170,7 +156,4 @@ - - - diff --git a/qt/pe/installer64.aip b/qt/pe/installer64.aip deleted file mode 100644 index 16e5b7fd..00000000 --- a/qt/pe/installer64.aip +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/qt/se/installer.aip b/qt/se/installer.aip index 33ee41fe..0e348ba8 100644 --- a/qt/se/installer.aip +++ b/qt/se/installer.aip @@ -33,19 +33,18 @@ + - - + - - + - + @@ -100,6 +99,9 @@ + + + @@ -108,29 +110,18 @@ - - + - - - - - - - - - - @@ -151,7 +142,6 @@ - @@ -166,7 +156,4 @@ - - - diff --git a/qt/se/installer64.aip b/qt/se/installer64.aip deleted file mode 100644 index 0e348ba8..00000000 --- a/qt/se/installer64.aip +++ /dev/null @@ -1,159 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -