Ejemplo n.º 1
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')
Ejemplo n.º 2
0
def freeze():
    from cx_Freeze import Executable, Freezer
    import shutil
    from distutils.dist import DistributionMetadata

    base = "Console"

    if sys.platform == "win32":
        base = "Win32GUI"

    dep_modules = ["PySide.QtNetwork", "PySide.QtWebKit", "atexit"]

    executables = [Executable('src/broom.py')]

    if os.path.exists(output_dir):
        shutil.rmtree(output_dir)

    class MetaData(DistributionMetadata):
        def __init__(self):
            DistributionMetadata.__init__(self)
            self.name = 'broom'
            self.version = __version__
            self.description = u'Broom ' + __version__

    freezer = Freezer(
        executables,
        includeFiles=[],
        includeMSVCR=True,
        packages=dep_modules,
        #includes=dep_modules,
        excludes=[],
        replacePaths=[],
        copyDependentFiles=True,
        base=base,
        path=sys.path + ['src'],
        createLibraryZip=True,
        appendScriptToExe=False,
        targetDir=output_dir,
        zipIncludes=[],
        #icon=icon
        metadata=MetaData())
    freezer.Freeze()
Ejemplo n.º 3
0
includes = freeze.get_includes()
excludes.extend(freeze.get_excludes())

## Freeze

ex = Executable(
    scriptFile,
    #icon=iconFile,
    #appendScriptToExe = True,
    #base = 'Win32GUI', # this is what hides the console
)

f = Freezer(
    {ex: True},
    includes=includes,
    excludes=excludes,
    targetDir=distDir,
    #copyDependentFiles = True,
    #appendScriptToExe=True,
    optimizeFlag=1,
    compress=False,
    silent=True,
)

f.Freeze()

# Copy resources.
# Some day, cx_Freeze should do this automatically ...
freeze.freeze_copy_resources(distDir, 'imageio')
Ejemplo n.º 4
0
                               }
                   },
    )

elif method == "cxfreeze":
    print "cxfreeze"
    from cx_Freeze import setup, Executable, Freezer
    exe = Executable(
        script="main.py",
        targetName="telesk.exe"
    )
    freezer = Freezer([exe],
        base = "Win32GUI",
        icon = "images\\telesk_default.ico",
        #compress = True,
        path = None,
        createLibraryZip = False,
        #copyDependentFiles =True,
        appendScriptToExe = True,
        #appendScriptToLibrary = True,
        targetDir = 'dist',
        #includes = ["sqlalchemy.dialects.mysql", "PyQt4.QtNetwork"],
        excludes = ['_gtkagg', '_tkagg', 'bsddb', 'curses', 'email', 'pywin.debugger', 'pywin.debugger.dbgcon', 'pywin.dialogs',"Tkconstants","Tkinter","tcl"]
    )
    freezer.Freeze()
    """setup(
        name = "Telesk",
        version = "0.2",
        description = "Telesk Softphone by SKAT LTD",
        executables = [exe]
    )"""