1 | #!/usr/bin/env python |
---|
2 | # -*- coding: utf-8 -*- |
---|
3 | |
---|
4 | """ |
---|
5 | Usage: |
---|
6 | Install cx_Freeze: http://cx-freeze.sourceforge.net/ |
---|
7 | Copy script to the web2py directory |
---|
8 | c:\Python27\python standalone_exe_cxfreeze.py build_exe |
---|
9 | """ |
---|
10 | from cx_Freeze import setup, Executable |
---|
11 | from gluon.import_all import base_modules, contributed_modules |
---|
12 | from gluon.fileutils import readlines_file |
---|
13 | from glob import glob |
---|
14 | import fnmatch |
---|
15 | import os |
---|
16 | import shutil |
---|
17 | import sys |
---|
18 | import re |
---|
19 | |
---|
20 | #read web2py version from VERSION file |
---|
21 | web2py_version_line = readlines_file('VERSION')[0] |
---|
22 | #use regular expression to get just the version number |
---|
23 | v_re = re.compile('[0-9]+\.[0-9]+\.[0-9]+') |
---|
24 | web2py_version = v_re.search(web2py_version_line).group(0) |
---|
25 | |
---|
26 | base = None |
---|
27 | |
---|
28 | if sys.platform == 'win32': |
---|
29 | base = "Win32GUI" |
---|
30 | |
---|
31 | base_modules.remove('macpath') |
---|
32 | buildOptions = dict( |
---|
33 | compressed=True, |
---|
34 | excludes=["macpath", "PyQt4"], |
---|
35 | includes=base_modules, |
---|
36 | include_files=[ |
---|
37 | 'applications', |
---|
38 | 'ABOUT', |
---|
39 | 'LICENSE', |
---|
40 | 'VERSION', |
---|
41 | 'logging.example.conf', |
---|
42 | 'options_std.py', |
---|
43 | 'app.example.yaml', |
---|
44 | 'queue.example.yaml', |
---|
45 | ], |
---|
46 | # append any extra module by extending the list below - |
---|
47 | # "contributed_modules+["lxml"]" |
---|
48 | packages=contributed_modules, |
---|
49 | ) |
---|
50 | |
---|
51 | setup( |
---|
52 | name="Web2py", |
---|
53 | version=web2py_version, |
---|
54 | author="Massimo DiPierro", |
---|
55 | description="web2py web framework", |
---|
56 | license="LGPL v3", |
---|
57 | options=dict(build_exe=buildOptions), |
---|
58 | executables=[Executable("web2py.py", |
---|
59 | base=base, |
---|
60 | compress=True, |
---|
61 | icon="web2py.ico", |
---|
62 | targetName="web2py.exe", |
---|
63 | copyDependentFiles=True)], |
---|
64 | ) |
---|