forked from thartbm/PyVMEC
-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
126 lines (99 loc) · 4.32 KB
/
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
116
117
118
119
120
121
122
123
124
125
126
from distutils.core import setup
import setuptools
import matplotlib
import py2exe
import sys
sys.setrecursionlimit(3000)
import os
# pandas._libs.tslibs.conversion._TSObject should have an attribute __reduce_cython__
# in versions of pandas > 0.20.0 (at least for Python < 3.4)
# so: pip install pandas==0.20.0
# with psychopy 1.90.0 and pyglet 1.3.2 we get an error that the window has no close() attribute
# someone solved this like this:
# pip install psychopy==1.85.3
# pip install pyglet==1.3.0
# this removes the error, but the experiment still doesn't work
#Initialize Holder Files
preference_files = []
app_files = []
builder_files = []
lib23_files = []
pandas_libs_files = []
visual_files = []
misc_files = []
some_dlls = []
my_data_files=matplotlib.get_py2exe_datafiles()
#define which files you want to copy for data_files
for files in os.listdir('C:\\Python27\\Lib\\site-packages\\psychopy\\preferences\\'):
f1 = 'C:\\Python27\\Lib\\site-packages\\psychopy\\preferences\\' + files
preference_files.append(f1)
app_files = [os.path.join(dp, f) for dp, dn, filenames in os.walk('C:\\Python27\\Lib\\site-packages\\psychopy\\app\\') for f in filenames]
lib23_files = [os.path.join(dp, f) for dp, dn, filenames in os.walk('C:\\Python27\\Lib\\lib2to3\\') for f in filenames]
pandas_libs_files = [os.path.join(dp, f) for dp, dn, filenames in os.walk('C:\\Python27\\Lib\\site-packages\\pandas\\_libs\\') for f in filenames]
visual_files = [os.path.join(dp, f) for dp, dn, filenames in os.walk('C:\\Python27\\Lib\\site-packages\\psychopy\\visual\\') for f in filenames]
misc_files = [os.path.join(dp, f) for dp, dn, filenames in os.walk('C:\\Python27\\Lib\\site-packages\\psychopy\\misc\\') for f in filenames]
import glob
some_dlls += glob.glob('C:\\Python27\\DLLs\\libansari.*')
some_dlls += glob.glob('C:\\Python27\\DLLs\\liblbfgsb.*')
some_dlls += glob.glob('C:\\Python27\\DLLs\\libgetbreak.*')
some_dlls += glob.glob('C:\\Python27\\DLLs\\libdqag.*')
#some_dlls += 'C:\\Windows\\System32\\avbin.dll'
print(some_dlls)
all_files = [ ("psychopy\\preferences", preference_files),
("psychopy\\app", app_files),
("psychopy\\visual", visual_files),
("psychopy\\misc", misc_files),
('lib2to3', lib23_files),
("pandas\\_lib", pandas_libs_files),
'VMEC.ico'
]
#combine the files
#all_files = [("psychopy\\preferences", preference_files), my_data_files[0]]
#all_files = [("psychopy\\preferences", preference_files)]
all_files += some_dlls
import matplotlib as mpl
all_files += mpl.get_py2exe_datafiles()
#setup(options={"py2exe":{"dll_excludes":["MSVCP90.dll"]}}, console=['PyVMEC.py'], data_files=data_files)
setup(
options = {
"py2exe": {
#"bundle_files": 1,
"includes": ["pandas",
"pyautogui",
"psychopy",
"psychopy.visual.shape",
"psychopy.visual.circle",
"psychopy.misc",
"UserList",
"UserString",
"numpy",
"scipy.sparse.csgraph._validation",
"scipy.linalg.cython_blas",
"scipy.linalg.cython_lapack",
"scipy.linalg",
"scipy.special._ufuncs_cxx",
"scipy._lib.messagestream",
"pyglet.resource",
"PIL.Image",
"pkg_resources._vendor.appdirs",
"pkg_resources._vendor.packaging",
"pkg_resources._vendor.packaging.version",
"pkg_resources._vendor.packaging.specifiers",
"pkg_resources._vendor.packaging.requirements"],
"dll_excludes":["MSVCP90.dll"],
"excludes":["gevent._socket3"],
"skip_archive": True,
"optimize": 2,
"dist_dir": "PyVMEC"
}
},
console=['PyVMEC.py'],
data_files = all_files,
# windows = [{
# "script":"PyVMEC.py",
# "icon_resources": [(1, "VMEC.ico")],
# }],
)
# run this from command line with the following command:
# $ python setup.py py2exe
# from the directory where the to be compiled script is