forked from simpeg/discretize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
105 lines (92 loc) · 3.02 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
#!/usr/bin/env python
"""discretize
Discretization tools for finite volume and inverse problems.
"""
import os
import sys
from setuptools import setup, find_packages
CLASSIFIERS = [
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Mathematics",
"Topic :: Scientific/Engineering :: Physics",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: Unix",
"Operating System :: MacOS",
"Natural Language :: English",
]
with open("README.rst") as f:
LONG_DESCRIPTION = "".join(f.readlines())
build_requires = [
"numpy>=1.8",
"cython>=0.2",
"setuptools_scm",
]
install_requires = [
"numpy>=1.8",
"scipy>=0.13",
]
metadata = dict(
name="discretize",
packages=find_packages(include=["discretize", "discretize.*"]),
python_requires=">=3.7",
setup_requires=build_requires,
install_requires=install_requires,
author="SimPEG developers",
author_email="[email protected]",
description="Discretization tools for finite volume and inverse problems",
long_description=LONG_DESCRIPTION,
license="MIT",
keywords="finite volume, discretization, pde, ode",
url="http://simpeg.xyz/",
download_url="http://github.com/simpeg/discretize",
classifiers=CLASSIFIERS,
platforms=["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"],
use_scm_version={
"write_to": os.path.join("discretize", "version.py"),
}
)
if len(sys.argv) >= 2 and (
"--help" in sys.argv[1:]
or sys.argv[1] in ("--help-commands", "egg_info", "--version", "clean")
):
# For these actions, build_requires are not required.
#
# They are required to succeed without Numpy/Cython, for example when
# pip is used to install discretize when Numpy/Cython is not yet
# present in the system.
pass
else:
from setuptools.extension import Extension
from Cython.Build import cythonize
import numpy as np
ext_kwargs = {}
if os.environ.get("DISC_COV", None) is not None:
ext_kwargs["define_macros"] = [("CYTHON_TRACE_NOGIL", 1)]
extensions = [
Extension(
"discretize._extensions.interputils_cython",
["discretize/_extensions/interputils_cython.pyx"],
include_dirs=[np.get_include()],
**ext_kwargs
),
Extension(
"discretize._extensions.tree_ext",
["discretize/_extensions/tree_ext.pyx", "discretize/_extensions/tree.cpp"],
include_dirs=[np.get_include()],
**ext_kwargs
),
Extension(
"discretize._extensions.simplex_helpers",
["discretize/_extensions/simplex_helpers.pyx"],
include_dirs=[np.get_include()],
**ext_kwargs
)
]
metadata['ext_modules'] = cythonize(extensions)
setup(**metadata)