-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
87 lines (76 loc) · 2.46 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
import os
import sys
import subprocess
try:
from setuptools import setup, Extension
except ImportError:
from distutils.core import setup, Extension
import cosmogenic
ISRELEASED = False
try:
from sphinx.setup_command import BuildDoc
HAVE_SPHINX = True
except:
HAVE_SPHINX = False
if HAVE_SPHINX:
class CosmogenicBuildDoc(BuildDoc):
"""Run in-place build before Sphinx doc build"""
def run(self):
ret = subprocess.call([sys.executable, sys.argv[0], 'build_ext',
'--inplace'])
if ret != 0:
raise RuntimeError("Building Cosmogenic failed!")
BuildDoc.run(self)
def setup_package():
if HAVE_SPHINX:
cmdclass = {'build_sphynx': CosmogenicBuildDoc}
else:
cmdclass = {}
cwd = os.path.dirname(os.path.abspath(__file__))
if not os.path.exists(os.path.join(cwd, 'PKG-INFO')):
# Compile Cython modules unless building from source release.
from Cython.Build import cythonize
import numpy
numpy_include = numpy.get_include()
ext_modules = cythonize([
Extension(
"cosmogenic.muon",
["cosmogenic/muon.pyx"],
libraries=["m"],
include_dirs=[numpy_include]),
Extension(
"cosmogenic.parma",
["cosmogenic/parma.pyx"],
include_dirs=[numpy_include]),
])
setup(
name="cosmogenic",
packages=["cosmogenic"],
version=cosmogenic.__version__,
description="Library for modeling cosmogenic nuclides",
author="Zach Ploskey",
author_email="[email protected]",
url="http://github.com/zploskey/cosmogenic",
keywords=["cosmic rays", "geomorphology", "modeling"],
license="BSD",
cmdclass=cmdclass,
classifiers=[
"License :: OSI Approved :: BSD License",
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
],
requires=[
"numpy (>=1.6)",
"scipy (>=0.11)",
"matplotlib (>=1.1)",
],
install_requires=[
"numpy",
],
ext_modules=ext_modules,
)
if __name__ == '__main__':
setup_package()