| 1 |
|
| 2 |
import os |
| 3 |
import re |
| 4 |
import sys |
| 5 |
|
| 6 |
import numpy |
| 7 |
from Cython.Build import cythonize |
| 8 |
from setuptools import setup |
| 9 |
from setuptools.extension import Extension |
| 10 |
|
| 11 |
here = os.path.dirname(os.path.abspath(__file__)) |
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
fname = os.path.join("src", "extinction", "_extinction.pyx") |
| 16 |
version = re.findall(r"__version__ = \"(.*?)\"", open(fname).read())[0] |
| 17 |
|
| 18 |
|
| 19 |
source_files = [fname, os.path.join("extern", "bs.c")] |
| 20 |
depends_files = [ |
| 21 |
os.path.join("extern", "bs.h"), |
| 22 |
os.path.join("extern", "bsplines.pxi") |
| 23 |
] |
| 24 |
include_dirs = [numpy.get_include(), "extern"] |
| 25 |
|
| 26 |
|
| 27 |
extra_compile_args = [] if sys.platform == "win32" else ["-std=c11"] |
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
define_macros = [("NPY_NO_DEPRECATED_API", "NPY_1_7_API_VERSION")] |
| 32 |
|
| 33 |
extensions = [ |
| 34 |
Extension( |
| 35 |
"extinction._extinction", |
| 36 |
source_files, |
| 37 |
include_dirs=include_dirs, |
| 38 |
depends=depends_files, |
| 39 |
define_macros=define_macros, |
| 40 |
extra_compile_args=extra_compile_args, |
| 41 |
) |
| 42 |
] |
| 43 |
|
| 44 |
setup( |
| 45 |
version=version, |
| 46 |
|
| 47 |
|
| 48 |
ext_modules=cythonize(extensions, language_level=3, include_path=[here]), |
| 49 |
) |