The branch, master has been updated via eea34d1e7db596e3ed69f9c9965d6b7f52deba93 (commit) from fecb8d6798efb1b1c4c6ad693bd1b5dfb2bb73a2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit eea34d1e7db596e3ed69f9c9965d6b7f52deba93 Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Date: Sun Apr 21 17:21:54 2013 +0200 MS Windows: use bbfreeze to freeze the Win32 version of PyHoca-GUI. ----------------------------------------------------------------------- Summary of changes: debian/changelog | 1 + setup.py | 148 +++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 125 insertions(+), 24 deletions(-) The diff of changes is: diff --git a/debian/changelog b/debian/changelog index a0cfec1..78a607d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ pyhoca-gui (0.4.0.2-0~x2go1) UNRELEASED; urgency=low - Make PyHoca-GUI aware of the Cinnamon desktop shell. - Make sure that there is no KeyException when checking/unchecking the restoreexports item in the shared folders menu. + - MS Windows: use bbfreeze to freeze the Win32 version of PyHoca-GUI. -- Mike Gabriel <mike.gabriel@das-netzwerkteam.de> Wed, 13 Feb 2013 12:51:24 +0100 diff --git a/setup.py b/setup.py index eabb468..01b0e24 100755 --- a/setup.py +++ b/setup.py @@ -35,12 +35,23 @@ URL = 'http://www.x2go.org' LIBRARY_ZIP = r"lib\shardlib.zip" from setuptools import setup, find_packages -from distutils.core import setup +from distutils.core import setup, Command import platform +base = None +executables = [] if platform.system() == 'Windows': + default_win32exe_freezer = 'bbfreeze' NSIS_COMPILE = os.path.join(os.environ['ProgramFiles'], 'NSIS', 'makensis.exe') - from py2exe.build_exe import py2exe + if 'build_with_py2exe' in (sys.argv[1], 'build_with_{freezer}'.format(freezer=default_win32exe_freezer)): + from py2exe.build_exe import py2exe + Freezer = object + elif 'build_with_bbfreeze' in (sys.argv[1], 'build_with_{freezer}'.format(freezer=default_win32exe_freezer)): + from bbfreeze import Freezer + py2exe = object + else: + py2exe = object + Freezer = object import os, os.path import subprocess sys.path.append(os.path.normpath('../pyhoca-contrib/mswin/ms-vc-runtime')) @@ -48,6 +59,7 @@ if platform.system() == 'Windows': elif platform.system() == 'Linux': from DistUtilsExtra.command import * py2exe = object + Freezer = object from glob import glob import shutil @@ -108,27 +120,33 @@ class NSISScript(object): raise RuntimeError("NSIS compilation return code: %d" % retcode) -class build_installer(py2exe): +class build_installer(object): - # This class first builds the exe file(s), then creates an NSIS installer - # that runs your program from a temporary directory. + # This class first invokes building the the exe file(s) and then creates an NSIS + # installer + def __init__(self, dist_dir): + self.dist_dir = dist_dir + + def do_build_exe(self): + # replace this method with the freezer's build_exe logic + pass def run(self): + # clean up dist_dir shutil.rmtree(self.dist_dir, ignore_errors=True) + # and recreate a clean one afterwards + os.makedirs(self.dist_dir) - # First, let py2exe do it's work. - py2exe.run(self) - - lib_dir = self.lib_dir - dist_dir = self.dist_dir + # First, build the exe file + self.do_build_exe() # Create the installer, using the files py2exe has created. script = NSISScript( PROGRAM_NAME, PROGRAM_DESC, PROGRAM_VERSION, - dist_dir, + self.dist_dir, os.path.normpath(PROGRAM_ICON) ) print "*** creating the NSIS setup script***" @@ -136,6 +154,75 @@ class build_installer(py2exe): print "*** compiling the NSIS setup script***" script.compile() + +class build_installer_py2exe(build_installer, py2exe): + + def __init__(self, *args, **kwargs): + py2exe.__init__(self, *args, **kwargs) + build_installer.__init__(dist_dir=self.dist_dir) + + def do_build_exe(self): + + # First, let py2exe do it's work. + py2exe.run(self) + +class build_installer_bbfreeze(build_installer, Freezer, Command): + + user_options = [ + ('dist-dir=', 'd', + "directory to put final built distributions in (default is dist)"), + + ("excludes=", 'e', + "comma-separated list of modules to exclude"), + ("includes=", 'i', + "comma-separated list of modules to include"), + ] + + def __init__(self, *args, **kwargs): + Command.__init__(self, *args) + build_installer.__init__(self, dist_dir=self.dist_dir) + + def initialize_options(self): + self.includes = [] + self.excludes = [] + self.packages = [] + self.compressed = False + self.dist_dir = None + + def finalize_options(self): + self.includes = fancy_split(self.includes) + self.excludes = fancy_split(self.excludes) + self.compressed = False + if self.dist_dir is None: + self.dist_dir = 'dist' + self.dist_dir = os.path.abspath(os.path.join(os.getcwd(), self.dist_dir)) + if not os.path.exists(self.dist_dir): + os.makedirs(self.dist_dir) + + def do_build_exe(self): + Freezer.__init__(self, self.dist_dir, + includes=self.includes, + excludes=self.excludes, + ) + self.addScript("pyhoca-gui") + Freezer.__call__(self) + if self.distribution.has_data_files(): + print "*** copy data files ***" + install_data = self.reinitialize_command('install_data') + install_data.install_dir = self.dist_dir + install_data.ensure_finalized() + install_data.run() + +def fancy_split(str, sep=","): + # a split which also strips whitespace from the items + # passing a list or tuple will return it unchanged + if str is None: + return [] + if hasattr(str, "split"): + return [item.strip() for item in str.split(sep)] + return str + + if platform.system() == 'Windows': dll_data_files = [("Microsoft.VC90.CRT", glob(r'..\\pyhoca-contrib\\mswin\\ms-vc-runtime\\*.*'))] @@ -159,9 +246,11 @@ if platform.system() == 'Windows': cmd_class.update( { - "build_exe": build_installer, + "build_with_py2exe": build_installer_py2exe, + "build_with_bbfreeze": build_installer_bbfreeze, } ) + cmd_class.update({ 'build_exe': cmd_class['build_with_{freezer}'.format(freezer=default_win32exe_freezer)] }) elif platform.system() == 'Linux': cmd_class.update( @@ -187,6 +276,27 @@ elif platform.system() == 'Linux': manpage_files ) +if platform.system() == 'Windows': + cmd_options={ + 'py2exe': { + 'includes': ['greenlet', 'gevent.core', 'gevent.ares', 'gevent._semaphore', 'gevent._util', ], + 'compressed': 1, + 'optimize': 2, + }, + 'build_with_py2exe': { + 'includes': ['greenlet', 'gevent.core', 'gevent.ares', 'gevent._semaphore', 'gevent._util', ], + 'compressed': 1, + 'optimize': 2, + }, + 'build_with_bbfreeze': { + 'includes': ['greenlet', 'gevent.core', 'gevent.ares', 'gevent._semaphore', 'gevent._util', ], + 'excludes': ['MSVCR90.dll', 'MSVCP90.dll', ], + } + } + cmd_options.update({ 'build_exe': cmd_options['build_with_{freezer}'.format(freezer=default_win32exe_freezer)] }) +else: + cmd_options={} + setup( name = PROGRAM_NAME, version = PROGRAM_VERSION, @@ -208,16 +318,6 @@ setup( ], data_files=data_files, zipfile = LIBRARY_ZIP, - options={ - 'py2exe': { - 'includes': ['greenlet', 'gevent.core', ], - 'compressed': 1, - 'optimize': 2, - }, - 'build_exe': { - 'includes': ['greenlet', 'gevent.core', ], - 'compressed': 1, - 'optimize': 2, - } - } + executables = executables, + options=cmd_options, ) hooks/post-receive -- pyhoca-gui.git (Python X2Go Client (wxPython GUI)) This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "pyhoca-gui.git" (Python X2Go Client (wxPython GUI)).