-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
149 lines (134 loc) · 6.06 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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
# -*- encoding: utf-8 -*-
'''
Script used for setup and installation purpose.
The script can create exe stand alone programs under windows, but py2app doesn't word until now.
'''
import sys, os
from glob import glob
import matplotlib
try:
# Use easy setup to ensure dependencies
import ez_setup
ez_setup.use_setuptools()
except ImportError:
pass
__package_name__='QuickNXS'
__author__="Artur Glavic"
__copyright__="Copyright 2012-2015"
__license__="GPL v3"
__email__="[email protected]"
__author_email__=__email__
__url__="http://"
__description__='''Magnetism reflectometer data reduction software'''
__scripts__=['scripts/quicknxs', 'scripts/quicklog', 'scripts/nxsdialog']
__py_modules__=[]
__package_dir__={}
__packages__=['quicknxs', 'quicknxs.config', 'quicknxs.buzhug']
__package_data__={'quicknxs': ['default_config.cfg', 'htmldoc/*', 'genx_templates/*.gx']}
__data_files__=[('/usr/share/applications', ['dist_data/sns-quicknxs.desktop']),
('/usr/share/icons/gnome/128x128/apps/', ['dist_data/quicknxs.png'])]
if "py2exe" in sys.argv:
import py2exe #@UnusedImport @UnresolvedImport
import zmq
os.environ["PATH"]+=os.path.pathsep+os.path.split(zmq.__file__)[0]
__data_files__=matplotlib.get_py2exe_datafiles()
sys.path.append("..\\App")
__data_files__+=[('Microsoft.VC90.CRT', glob('..\\App\\msvc*.dll')+['..\\App\\Microsoft.VC90.CRT.manifest'])]
__data_files__+=[#(r'quicknxs', [r'quicknxs\default_config.cfg']),
(r'quicknxs\genx_templates', glob(r'quicknxs\genx_templates\*.gx')),
(r'quicknxs\htmldoc', glob(r'quicknxs\htmldoc\*')),
("IPython\\config\\profile", glob('..\\App\\Lib\\site-packages\\IPython\\config\\profile\\*.*')+
glob('..\\App\\Lib\\site-packages\\IPython\\config\\profile\\README*')),
("IPython\\config\\profile\\cluster", glob('..\\App\\Lib\\site-packages\\IPython\\config\\profile\\cluster\\*')),
]
pexe=os.path.abspath(os.path.join('..\\App'))
sys.path.append(pexe)
__options__={
"windows": [ {
"script": "scripts/quicknxs",
"icon_resources": [(1, "icons/logo.ico")],
}, ], # executable for py2exe is windows application
"options": { "py2exe": {
"includes": ["sip", "numpy", "scipy.stats.mstats",
# "zmq.utils", "zmq.utils.jsonapi", "zmq.utils.strtypes",
],
"optimize": 1, # Keep docstring (e.g. Shell usage)
"skip_archive": True, # setting not to move compiled code into library.zip file
'packages': ['PyQt4', 'h5py', 'zmq', 'pygments', 'IPython'],
"dll_excludes": [],
'excludes': [ 'doctest', 'tcl', 'tk', 'Tkinter',
'_gtkagg', '_tkagg', '_wxagg',
'_gtk', '_gtkcairo', '_agg2', '_cairo',
'_cocoaagg', '_fltkagg',
],
},
}
}
elif 'py2app' in sys.argv:
import py2app #@UnusedImport @UnresolvedImport
__data_files__=[]
__options__={
'app': ["scripts/quicknxs"],
'options': {'py2app': {
'optimize': 1,
'compressed': False,
'argv_emulation': False,
'iconfile': 'dist_data/quicknxs.icns',
'includes': ['sip', 'PyQt4._qt', 'PyQt4.QtWebKit', 'PyQt4.QtNetwork'],
'packages': ['h5py', 'zmq', 'pygments', 'IPython'],
'excludes': [ 'doctest', 'tcl', 'tk', 'Tkinter',
'_gtkagg', '_tkagg', '_wxagg',
'_gtk', '_gtkcairo', '_agg2', '_cairo',
'_cocoaagg', '_fltkagg',
],
}}
}
else:
__options__={}
__requires__=['numpy', 'matplotlib']
from distutils.core import setup
# extensions modules written in C
__extensions_modules__=[]
if 'install' not in sys.argv:
# Remove MANIFEST before distributing to be sure no file is missed
if os.path.exists('MANIFEST'):
os.remove('MANIFEST')
# make sure revision is correct before building
from subprocess import call
#if not 'py2exe' in sys.argv:
# call(['/usr/bin/env', 'python', 'dist_data/update_version.py'])
if ('sdist' in sys.argv or 'py2exe' in sys.argv or 'py2app' in sys.argv) and \
not '--nocheck' in sys.argv:
print "Running unit test before compiling build distribution."
from test_all import test_suites
import unittest
runner=unittest.TextTestRunner(sys.stderr, 'Pre-Build unit test run', 2)
suite=unittest.TestSuite(test_suites.values())
result=runner.run(suite)
if len(result.errors+result.failures):
print "Not all tests were successfull, stop building distribution!"
exit()
if '--nocheck' in sys.argv:
sys.argv.remove('--nocheck')
from quicknxs.version import str_version
__version__=str_version
#### Run the setup command with the selected parameters ####
setup(name=__package_name__,
version=__version__,
description=__description__,
author=__author__,
author_email=__email__,
url=__url__,
scripts=__scripts__,
py_modules=__py_modules__,
ext_modules=__extensions_modules__,
packages=__packages__,
package_dir=__package_dir__,
package_data=__package_data__,
data_files=__data_files__,
requires=__requires__, #does not do anything
**__options__
)
if 'py2app' in sys.argv:
# add qt.conf which fixes issues with the app and a currently installed qt4 library
open('dist/QuickNXS.app/Contents/Resources/qt.conf', 'w').write(open('dist_data/qt.conf', 'r').read())