-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
85 lines (69 loc) · 2.72 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
#!/usr/bin/env python
import os
from distutils.core import setup, Extension
from distutils.command.sdist import sdist
try: # Python 3.x
from distutils.command.build_py import build_py_2to3 as build_py
except ImportError: # Python 2.x
from distutils.command.build_py import build_py
from numpy import get_include as get_numpy_include
from hyperion.testing.helper import HyperionTest
from hyperion.version import __version__, __dev__
class custom_sdist(sdist):
user_options = sdist.user_options + [('unstable', None, "make an unstable release (keep __dev__=True)")]
def __init__(self, *args, **kwargs):
sdist.__init__(self, *args, **kwargs)
self.unstable = False
def run(self):
if not self.unstable:
version_file = 'hyperion/version.py'
content = open(version_file, 'rb').read()
open(version_file, 'wb').write(content.replace('__dev__ = True', "__dev__ = False"))
try:
sdist.run(self)
finally:
if not self.unstable:
open(version_file, 'wb').write(content)
numpy_includes = get_numpy_include()
cmdclass = {}
cmdclass['build_py'] = build_py
cmdclass['test'] = HyperionTest
cmdclass['sdist'] = custom_sdist
ext_modules = [Extension("hyperion.util._integrate_core",
['hyperion/util/_integrate_core.c'],
include_dirs=[numpy_includes]),
Extension("hyperion.util._interpolate_core",
['hyperion/util/_interpolate_core.c'],
include_dirs=[numpy_includes])]
scripts = ['hyperion', 'hyperion2fits']
if __dev__:
scripts.append('mctherm2hyperion')
setup(name='hyperion',
version=__version__,
url='http://www.hyperion-rt.org',
author='Thomas Robitaille',
author_email='[email protected]',
packages=['hyperion',
'hyperion.conf',
'hyperion.densities',
'hyperion.densities.tests',
'hyperion.dust',
'hyperion.dust.tests',
'hyperion.grid',
'hyperion.grid.tests',
'hyperion.importers',
'hyperion.model',
'hyperion.model.tests',
'hyperion.sources',
'hyperion.sources.tests',
'hyperion.sphinx',
'hyperion.sphinx.ext',
'hyperion.testing',
'hyperion.util',
'hyperion.util.tests'],
package_data={'hyperion.model.tests':['data/*.rtout', 'data/*.hdf5'],
'hyperion.testing':['coveragerc']},
scripts=['scripts/' + x for x in scripts],
cmdclass=cmdclass,
ext_modules = ext_modules
)