-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsetup.py
More file actions
84 lines (73 loc) · 2.51 KB
/
setup.py
File metadata and controls
84 lines (73 loc) · 2.51 KB
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
import sys
import os
import glob
import shutil
from cx_Freeze import setup, Executable
def collect_plots():
uis = []
mods = []
for fn in glob.glob('gui/plots/ui_*.ui'):
uis.append(fn)
mod = os.path.basename(os.path.splitext(fn)[0])
mod = mod.replace('ui_plot', 'plot_')
mods.append('gui.plots.'+mod)
return (uis, mods)
def collect_uis():
uis = []
for fn in glob.glob('gui/ui_*.ui'):
uis.append(fn)
return uis
plot_uis, plot_mods = collect_plots()
uis = collect_uis()
# Dependencies are automatically detected, but it might need
# fine tuning.
buildOptions = dict(
packages = [],
includes = ['gui.matplotlibwidget'] + plot_mods,
excludes = ['scipy',
'tcl',
'tkinter'],
include_files = ['default.cgp',
'gui/icons',
'gui/data',
] + plot_uis + uis,
build_exe = './dist/'
)
base = 'Win32GUI' if sys.platform=='win32' else None
executables = [
Executable('CoatingGUI.py',
base=base,
targetName = 'coatinggui.exe',
compress=True,
targetDir='./dist/',
icon='./gui/icons/coatinggui.ico')
]
setup(name='CoatingGUI',
version = '0.3',
description = 'CoatingGUI simulates dielectric mirror coatings.',
options = dict(build_exe = buildOptions),
executables = executables)
# Now clean up unnecessary stuff
if sys.platform == 'win32':
remove_dirs = ['mpl-data/images', 'mpl-data/sample_data', 'mpl-data/fonts', 'PyQt4.uic.widget-plugins', 'tcl', 'tk']
remove_files = ['numpy.core._dotblas.pyd', 'PyQt4.QtNetwork.pyd', 'PyQt4.QtWebKit.pyd',
'QtNetwork4.dll', 'QtWebKit4.dll', 'tcl85.dll', 'tk85.dll', 'wx._controls_.pyd',
'wx._core_.pyd', 'wx._gdi_.pyd', 'wx._misc_.pyd', 'wx._windows_.pyd',
'wxbase28uh_net_vc.dll', 'wxbase28uh_vc.dll', 'wxmsw28uh_adv_vc.dll',
'wxmsw28uh_core_vc.dll', 'wxmsw28uh_html_vc.dll',
'SSLEAY32.dll', 'LIBEAY32.dll', 'gdiplus.dll',
'bz2.pyd', '_ssl.pyd', 'LIBBZ2.dll']
for dd in remove_dirs:
path = './dist/'+dd
print 'Cleaning up', path
try:
shutil.rmtree(path)
except Exception, e:
print e
for ff in remove_files:
path = './dist/'+ff
print 'Cleaning up', path
try:
os.remove(path)
except Exception, e:
print e