def package_windows(dev): from cx_Freeze import Freezer, Executable app_version = get_module_version('core') if op.exists('dist'): shutil.rmtree('dist') is64bit = platform.architecture()[0] == '64bit' exe = Executable( targetName='PdfMasher.exe', script='run.py', base='Win32GUI', icon='images\\main_icon.ico', ) freezer = Freezer( [exe], # Since v4.2.3, cx_freeze started to falsely include tkinter in the package. We exclude it explicitly because of that. excludes=['tkinter'], ) freezer.Freeze() # Now we have to copy pdfminder's cmap to our root dist dir (We'll set CMAP_PATH env at runtime) import pdfminer.cmap cmap_src = op.dirname(pdfminer.cmap.__file__) cmap_dest = op.join('dist', 'cmap') shutil.copytree(cmap_src, cmap_dest) if not dev: # Copy qt plugins plugin_dest = op.join('dist', 'qt4_plugins') 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('dist') if op.splitext(name)[1] in ('.pyd', '.dll', '.exe') ] for lib in libs: print_and_do("upx --best \"dist\\{0}\"".format(lib)) help_path = 'build\\help' print("Copying {0} to dist\\help".format(help_path)) shutil.copytree(help_path, 'dist\\help') if is64bit: # In 64bit mode, we don't install the VC redist as a prerequisite. We just bundle the # appropriate dlls. shutil.copy(find_in_path('msvcr100.dll'), 'dist') shutil.copy(find_in_path('msvcp100.dll'), 'dist') if not dev: # 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 = 'qt\\installer64.aip' if is64bit else 'qt\\installer.aip' shutil.copy(installer_file, 'installer_tmp.aip') print_and_do( 'AdvancedInstaller.com /edit installer_tmp.aip /SetVersion {}'. format(app_version)) print_and_do('AdvancedInstaller.com /build installer_tmp.aip -force') os.remove('installer_tmp.aip')
def package_windows(edition, dev): if not ISWINDOWS: print("Qt packaging only works under Windows.") return add_to_pythonpath('.') app_version = get_module_version('core_{}'.format(edition)) distdir = 'dist' 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_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))) 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_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) print_and_do('AdvancedInstaller.com /build installer_tmp.aip -force') os.remove('installer_tmp.aip') if op.exists('installer_tmp.back.aip'): os.remove('installer_tmp.back.aip')
def package_windows(dev): if op.exists('dist'): shutil.rmtree('dist') is64bit = platform.architecture()[0] == '64bit' cmd = 'cxfreeze --base-name Win32GUI --target-name "moneyGuru.exe" --icon images\\main_icon.ico run.py' print_and_do(cmd) if not dev: # Copy qt plugins plugin_dest = op.join('dist', 'qt4_plugins') 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('dist') if op.splitext(name)[1] in ('.pyd', '.dll', '.exe')] for lib in libs: print_and_do("upx --best \"dist\\{0}\"".format(lib)) shutil.copytree('build\\help', 'dist\\help') shutil.copytree('build\\locale', 'dist\\locale') shutil.copytree('plugin_examples', 'dist\\plugin_examples') shutil.copy(find_in_path('msvcr100.dll'), 'dist') shutil.copy(find_in_path('msvcp100.dll'), 'dist') if not dev: # 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 = 'qt\\installer64.aip' if is64bit else 'qt\\installer.aip' shutil.copy(installer_file, 'installer_tmp.aip') print_and_do('AdvancedInstaller.com /edit installer_tmp.aip /SetVersion %s' % MoneyGuru.VERSION) print_and_do('AdvancedInstaller.com /build installer_tmp.aip -force') os.remove('installer_tmp.aip')
def package_windows(dev): from cx_Freeze import Freezer, Executable app_version = get_module_version('core') if op.exists('dist'): shutil.rmtree('dist') is64bit = platform.architecture()[0] == '64bit' exe = Executable( targetName = 'PdfMasher.exe', script = 'run.py', base = 'Win32GUI', icon = 'images\\main_icon.ico', ) freezer = Freezer( [exe], # Since v4.2.3, cx_freeze started to falsely include tkinter in the package. We exclude it explicitly because of that. excludes = ['tkinter'], ) freezer.Freeze() # Now we have to copy pdfminder's cmap to our root dist dir (We'll set CMAP_PATH env at runtime) import pdfminer.cmap cmap_src = op.dirname(pdfminer.cmap.__file__) cmap_dest = op.join('dist', 'cmap') shutil.copytree(cmap_src, cmap_dest) if not dev: # Copy qt plugins plugin_dest = op.join('dist', 'qt4_plugins') 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('dist') if op.splitext(name)[1] in ('.pyd', '.dll', '.exe')] for lib in libs: print_and_do("upx --best \"dist\\{0}\"".format(lib)) help_path = 'build\\help' print("Copying {0} to dist\\help".format(help_path)) shutil.copytree(help_path, 'dist\\help') if is64bit: # In 64bit mode, we don't install the VC redist as a prerequisite. We just bundle the # appropriate dlls. shutil.copy(find_in_path('msvcr100.dll'), 'dist') shutil.copy(find_in_path('msvcp100.dll'), 'dist') if not dev: # 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 = 'qt\\installer64.aip' if is64bit else 'qt\\installer.aip' shutil.copy(installer_file, 'installer_tmp.aip') print_and_do('AdvancedInstaller.com /edit installer_tmp.aip /SetVersion {}'.format(app_version)) print_and_do('AdvancedInstaller.com /build installer_tmp.aip -force') os.remove('installer_tmp.aip')
def package_windows(edition, dev): if not ISWINDOWS: print("Qt packaging only works under Windows.") return add_to_pythonpath('.') app_version = get_module_version('core_{}'.format(edition)) distdir = 'dist' 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_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))) 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')) if is64bit: # In 64bit mode, 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_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) print_and_do('AdvancedInstaller.com /build installer_tmp.aip -force') os.remove('installer_tmp.aip') if op.exists('installer_tmp.back.aip'): os.remove('installer_tmp.back.aip')