forked from NaturalHistoryMuseum/inselect
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·123 lines (112 loc) · 3.96 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
#!/usr/bin/env python
import sys
import inselect
# Generic setup data used for both the distutils setup and the cx_Freeze setup.
# win32.extra_packages and win32.include_files indicate extra packages/files
# that are not automatically detected by cx_Freeze. If running into problems,
# try including the whole of numpy/scipy.
setup_data = {
'name': 'inselect',
'version': inselect.__version__,
'description': inselect.__doc__,
'packages': ['inselect','inselect.gui.plugins', 'inselect.gui.views',
'inselect.gui.views.boxes', 'inselect.lib', 'inselect.workflow'],
'test_suite': 'inselect.tests',
'scripts': ['inselect/workflow/export_metadata.py',
'inselect/workflow/ingest.py',
'inselect/workflow/save_crops.py',
'inselect/workflow/segment.py'],
'install_requires' : open('requirements.txt').readlines(),
'entry_points': {
'console_scripts': [
'inselect = inselect.app:launch'
]
},
'win32': {
'executables': [
{
'script': 'inselect.py',
'targetName': 'inselect.exe',
'icon': 'data/inselect.ico',
'base': 'Win32GUI',
'shortcutName': 'Inselect', # See http://stackoverflow.com/a/15736406
'shortcutDir': 'ProgramMenuFolder'
},
{
'script': 'inselect/workflow/export_metadata.py',
'targetName': 'export_metadata.exe',
'icon': 'data/inselect.ico',
'base': 'Console'
},
{
'script': 'inselect/workflow/ingest.py',
'targetName': 'ingest.exe',
'icon': 'data/inselect.ico',
'base': 'Console'
},
{
'script': 'inselect/workflow/save_crops.py',
'targetName': 'save_crops.exe',
'icon': 'data/inselect.ico',
'base': 'Console'
},
{
'script': 'inselect/workflow/segment.py',
'targetName': 'segment.exe',
'icon': 'data/inselect.ico',
'base': 'Console'
},
],
'include_files': [
('{site_packages}/numpy', 'numpy'),
],
'extra_packages': [],
'excludes': ['Tkinter', 'ttk', 'Tkconstants', 'tcl']
}
}
def distutils_setup():
"""disttutils setup"""
from distutils.core import setup
setup(
name=setup_data['name'],
version=setup_data['version'],
packages=setup_data['packages'],
entry_points=setup_data['entry_points'],
install_requires=setup_data['install_requires'],
test_suite=setup_data['test_suite'],
scripts=setup_data['scripts'],
)
def cx_setup():
"""cx_Freeze setup. Used for building Windows installers"""
from cx_Freeze import setup, Executable
from distutils.sysconfig import get_python_lib
# Set path to include files
site_packages = get_python_lib()
include_files = []
for i in setup_data['win32']['include_files']:
include_files.append((
i[0].format(site_packages=site_packages),
i[1]
))
# Setup
setup(
name=setup_data['name'],
version=setup_data['version'],
options={
'build_exe': {
'packages': setup_data['packages'] + setup_data['win32']['extra_packages'],
'excludes': setup_data['win32']['excludes'],
'include_files': include_files,
'icon': 'data/inselect.ico'
},
'bdist_msi': {
'upgrade_code': '{fe2ed61d-cd5e-45bb-9d16-146f725e522f}'
}
},
executables=[Executable(**i) for i in setup_data['win32']['executables']]
)
# User cx_Freeze to build Windows installers, and distutils otherwise.
if 'bdist_msi' in sys.argv:
cx_setup()
else:
distutils_setup()