forked from snfactory/cubefit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·62 lines (49 loc) · 1.79 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
#!/usr/bin/env python
import os
import sys
from setuptools import setup
from setuptools.extension import Extension
from setuptools.command.test import test as TestCommand
import numpy
# Get __version__ from version.py without importing package itself.
with open('cubefit/version.py') as f:
exec(f.read())
fname = os.path.join("cubefit", "psffuncs.pyx")
USE_CYTHON = True
if not os.path.exists(fname):
fname = fname.replace(".pyx", ".c")
USE_CYTHON = False
exts = [Extension("cubefit.psffuncs", [fname],
include_dirs=[numpy.get_include()],
libraries=["m"])]
if USE_CYTHON:
from Cython.Build import cythonize
exts = cythonize(exts)
class PyTest(TestCommand):
"""Enables setup.py test"""
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
def initialize_options(self):
TestCommand.initialize_options(self)
self.pytest_args = []
def run_tests(self):
#import here, because outside the eggs aren't loaded
import pytest
errno = pytest.main(self.pytest_args)
sys.exit(errno)
setup(name="cubefit",
version=__version__,
description=("Fit combined supernova and galaxy model on a Nearby "
"Supernova Factory spectral data cube."),
license="MIT",
classifiers=["Topic :: Scientific/Engineering :: Astronomy",
"Intended Audience :: Science/Research"],
url="https://github.com/snfactory/cubefit",
author="Kyle Barbary, Seb Bongard, Clare Saunders",
author_email="[email protected]",
packages=['cubefit', 'cubefit.extern'],
ext_modules=exts,
scripts=['scripts/cubefit',
'scripts/cubefit-subtract',
'scripts/cubefit-plot'],
cmdclass={'test': PyTest}
)