-
Notifications
You must be signed in to change notification settings - Fork 3
/
cxfreeze_setup.py
117 lines (96 loc) · 3.65 KB
/
cxfreeze_setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import cx_Freeze
import sys, glob, os, os.path
import PySide
#import traceback
##############################################################################################
# Basic way to build this: run it, run the build exe (./zorro) from another terminal,
# include, exclude as needed.
# ALWAYS CALL AS ./zorro in Linux because the exe is not on the system path
# ALWAYS CALL AS ./zorro in Linux because the exe is not on the system path
# ALWAYS CALL AS ./zorro in Linux because the exe is not on the system path
# ALWAYS CALL AS ./zorro in Linux because the exe is not on the system path
#############################################################################################
#############################################################################################
# MUST MODIFY hooks.py IN cx_Freeze AS FOLLOWS:
#def load_scipy(finder, module):
# """the scipy module loads items within itself in a way that causes
# problems without the entire package and a number of other subpackages
# being present."""
# # finder.IncludePackage("scipy.lib")
# finder.IncludePackage("scipy._lib")
# finder.IncludePackage("scipy.misc")
# Monkey-patch cx_Freeze.hooks.load_scipy()
def load_scipy_monkeypatched(finder, module):
"""the scipy module loads items within itself in a way that causes
problems without the entire package and a number of other subpackages
being present."""
finder.IncludePackage("scipy._lib")
finder.IncludePackage("scipy.misc")
cx_Freeze.hooks.load_scipy = load_scipy_monkeypatched
#############################################################################################
# Need to exclude some dependencies that are definitely not needed.
# I would like to exlcude PyQt4 but Matplotlib crashes
if sys.version_info.major == 2:
excludes = [ 'collections.abc', 'Tkinter', 'pandas', ]
else:
excludes = [ 'Tkinter', 'pandas', ]
# Need to add some things scipy has imported in a funny way.
includes = ['scipy.sparse.csgraph._validation',
'scipy.integrate.lsoda',
'scipy.integrate.vode',
'scipy.special._ufuncs_cxx',
'scipy.special._ufuncs',
'scipy.special._ellip_harm_2',
'scipy.sparse.csgraph._validation',
'atexit',
'PySide.QtGui',
'PySide.QtCore',
]
# Ok now we have trouble with the matplotlib.backends
packages = [
'matplotlib.backends.backend_qt4agg',
'PySide.QtGui',
'PySide.QtCore',
'atexit',
]
# Inlcude graphics files. Could also add Readme and such.
include_files = [ "automator/icons/" ]
# Include Qt libs, because by default they are not present.
# Ok, so this does not fix the Qt library mis-match problem.
"""
QtDir = os.path.dirname( PySide.__file__ )
# TODO: Windows support for dll
QtFiles = [ (os.path.join( QtDir, "shiboken.so"), "shiboken.so" ) ]
QtLibGlob = glob.glob( os.path.join( QtDir, "Qt*" ) )
for globItem in QtLibGlob:
QtFiles.append( (globItem, os.path.basename(globItem)) )
include_files += QtFiles
"""
icon = "automator/icons/CINAlogo.png"
buildOptions = dict(
packages = packages,
excludes = excludes,
includes = includes,
include_files = include_files,
icon=icon )
base = 'Console'
if sys.platform == 'win32':
gui_base = "Win32GUI"
else:
gui_base = 'Console'
executables = [
cx_Freeze.Executable( script='zorro/__main__.py',
base=base,
targetName='zorro',
copyDependentFiles=True),
cx_Freeze.Executable( script='automator/__main__.py',
base=gui_base,
targetName='automator',
copyDependentFiles=True )
]
cx_Freeze.setup(name='Zorro',
version = '0.5',
description = 'Zorro image registration software',
options = dict(build_exe = buildOptions),
executables = executables,
)