예제 #1
0
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')
예제 #2
0
파일: package.py 프로젝트: hsoft/musicguru
def package_windows(dev):
    if sys.platform != "win32":
        print("Qt packaging only works under Windows.")
        return
    add_to_pythonpath('.')
    add_to_pythonpath('qt')
    os.chdir('qt')
    from app import MusicGuru
    
    if op.exists('dist'):
        shutil.rmtree('dist')
    
    cmd = 'cxfreeze --base-name Win32GUI --target-name musicGuru.exe --icon ..\\images\\mg_logo.ico start.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 
        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("xcopy /Y /S /I ..\\help\\musicguru_help dist\\help")

    # AdvancedInstaller.com has to be in your PATH
    # this copying is so we don't 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' % MusicGuru.VERSION)
    print_and_do('AdvancedInstaller.com /build installer_tmp.aip -force')
    os.remove('installer_tmp.aip')
    os.chdir(op.join('..', '..'))
예제 #3
0
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')
예제 #4
0
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')
예제 #5
0
def package_windows(dev):
    if not ISWINDOWS:
        print("Qt packaging only works under Windows.")
        return
    from cx_Freeze import setup, Executable
    distdir = 'dist'
    if op.exists(distdir):
        shutil.rmtree(distdir)

    options = {
        'build_exe': {
            'includes': 'atexit',
            'excludes': ['tkinter'],
            'icon': 'images\\main_icon.ico',
            'include_msvcr': True,
        },
        'install_exe': {
            'install_dir': distdir,
        }
    }

    executables = [
        Executable(
            'run.py',
            base='Win32GUI',
            targetDir=distdir,
            targetName='moneyGuru.exe',
        )
    ]

    setup(
        script_args=['install'],
        options=options,
        executables=executables
    )

    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)

    print("Copying forgotten DLLs")
    shutil.copy(find_in_path('msvcp110.dll'), distdir)
    print("Copying the rest")
    shutil.copytree('build\\help', 'dist\\help')
    shutil.copytree('build\\locale', 'dist\\locale')
    shutil.copytree('plugin_examples', 'dist\\plugin_examples')

    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
        shutil.copy('qt\\installer.aip', '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')
예제 #6
0
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')
예제 #7
0
def package_windows():
    if not ISWINDOWS:
        print("Qt packaging only works under Windows.")
        return
    from cx_Freeze import setup, Executable
    distdir = 'dist'
    if op.exists(distdir):
        shutil.rmtree(distdir)

    options = {
        'build_exe': {
            'includes': 'atexit',
            'excludes': ['tkinter'],
            'icon': 'images\\main_icon.ico',
            'include_msvcr': True,
        },
        'install_exe': {
            'install_dir': distdir,
        }
    }

    executables = [
        Executable(
            'run.py',
            base='Win32GUI',
            targetDir=distdir,
            targetName='moneyGuru.exe',
        )
    ]

    setup(
        script_args=['install'],
        options=options,
        executables=executables
    )

    # Copy qt plugins
    plugin_dest = op.join('dist', 'qt4_plugins')
    plugin_names = ['accessible', 'codecs', 'iconengines', 'imageformats']
    copy_qt_plugins(plugin_names, plugin_dest)

    print("Copying forgotten DLLs")
    shutil.copy(find_in_path('msvcp110.dll'), distdir)
    print("Copying the rest")
    shutil.copytree('build\\help', 'dist\\help')
    shutil.copytree('build\\locale', 'dist\\locale')

    # 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('qt\\installer.aip', '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')
예제 #8
0
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')
예제 #9
0
def package_windows(dev):
    if sys.platform != "win32":
        print("Qt packaging only works under Windows.")
        return
    add_to_pythonpath('.')
    add_to_pythonpath('qt')
    os.chdir('qt')
    from app import MusicGuru

    if op.exists('dist'):
        shutil.rmtree('dist')

    cmd = 'cxfreeze --base-name Win32GUI --target-name musicGuru.exe --icon ..\\images\\mg_logo.ico start.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
        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("xcopy /Y /S /I ..\\help\\musicguru_help dist\\help")

    # AdvancedInstaller.com has to be in your PATH
    # this copying is so we don't 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' %
        MusicGuru.VERSION)
    print_and_do('AdvancedInstaller.com /build installer_tmp.aip -force')
    os.remove('installer_tmp.aip')
    os.chdir(op.join('..', '..'))
예제 #10
0
파일: package.py 프로젝트: atiarda/dupeguru
def package_windows(edition, dev):
    if not ISWINDOWS:
        print("Qt packaging only works under Windows.")
        return
    from cx_Freeze import setup, Executable
    from PyQt5.QtCore import QLibraryInfo
    add_to_pythonpath('.')
    app_version = get_module_version('core_{}'.format(edition))
    distdir = 'dist'

    if op.exists(distdir):
        shutil.rmtree(distdir)

    if not dev:
        # Copy qt plugins
        plugin_dest = distdir
        plugin_names = ['accessible', 'codecs', 'iconengines', 'imageformats']
        copy_qt_plugins(plugin_names, plugin_dest)

    # 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 files")
    # Debug info that cx_freeze brings in.
    for fn in glob.glob(op.join(distdir, '*', '*.pdb')):
        os.remove(fn)
    print("Copying forgotten DLLs")
    qtlibpath = QLibraryInfo.location(QLibraryInfo.LibrariesPath)
    shutil.copy(op.join(qtlibpath, 'libEGL.dll'), distdir)
    shutil.copy(find_in_path('msvcp110.dll'), distdir)
    print("Copying the rest")
    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'))

    # 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 = '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')
예제 #11
0
def package_windows(edition, dev):
    if not ISWINDOWS:
        print("Qt packaging only works under Windows.")
        return
    from cx_Freeze import setup, Executable
    from PyQt5.QtCore import QLibraryInfo
    add_to_pythonpath('.')
    app_version = get_module_version('core_{}'.format(edition))
    distdir = 'dist'

    if op.exists(distdir):
        shutil.rmtree(distdir)

    if not dev:
        # Copy qt plugins
        plugin_dest = distdir
        plugin_names = ['accessible', 'codecs', 'iconengines', 'imageformats']
        copy_qt_plugins(plugin_names, plugin_dest)

    # 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 files")
    # Debug info that cx_freeze brings in.
    for fn in glob.glob(op.join(distdir, '*', '*.pdb')):
        os.remove(fn)
    print("Copying forgotten DLLs")
    qtlibpath = QLibraryInfo.location(QLibraryInfo.LibrariesPath)
    shutil.copy(op.join(qtlibpath, 'libEGL.dll'), distdir)
    shutil.copy(find_in_path('msvcp110.dll'), distdir)
    print("Copying the rest")
    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'))

    # 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 = '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')