Hello all, I have been looking at using cxfreeze to create a web2py standalone exe with custom libraries added in. Attached is the script used - Can be used if you want to repackage web2py's windows exe adding in custom libraries.
One of the major advantages of using cxfreeze for creating the standalone exe is the avoidance of the need for copying "MSVCR90.dll" to create the exe [ needed by py2exe -> http://www.py2exe.org/index.cgi/Tutorial#Step52 ]. This allows for easy building of the standalone exe with python 2.7. Massimo: The quit function in gluon/widget.py needs the sys.exit replaced by sys.exit(0) for the proper exit when using cxfreeze to create a standalone exe. i.e line 325 of gluon/widget.py needs to be replaced with sys.exit(0) . I would be grateful if you could make the change. Best Regards, Praneeth
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Usage: Install cx_Freeze: http://cx-freeze.sourceforge.net/ Copy script to the web2py directory c:\Python27\python standalone_exe_cxfreeze.py build_exe """ from cx_Freeze import setup, Executable from gluon.import_all import base_modules, contributed_modules from gluon.fileutils import readlines_file from glob import glob import fnmatch import os import shutil import sys import re #read web2py version from VERSION file web2py_version_line = readlines_file('VERSION')[0] #use regular expression to get just the version number v_re = re.compile('[0-9]+\.[0-9]+\.[0-9]+') web2py_version = v_re.search(web2py_version_line).group(0) base = None if sys.platform == 'win32': base = "Win32GUI" base_modules.remove('macpath') buildOptions = dict( compressed = True, excludes = ["macpath","PyQt4"], includes = base_modules, include_files=[ 'applications', 'ABOUT', 'LICENSE', 'VERSION', 'logging.example.conf', 'options_std.py', 'app.example.yaml', 'queue.example.yaml', ], # append any extra module by extending the list below - # "contributed_modules+["lxml"]" packages = contributed_modules, ) setup( name = "Web2py", version=web2py_version, author="Massimo DiPierro", description="web2py web framework", license = "LGPL v3", options = dict(build_exe = buildOptions), executables = [Executable("web2py.py", base=base, compress = True, icon = "web2py.ico", targetName="web2py.exe", copyDependentFiles = True)], )