-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathsetup.py
More file actions
46 lines (39 loc) · 1.19 KB
/
setup.py
File metadata and controls
46 lines (39 loc) · 1.19 KB
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
#!/usr/bin/env python
# pylint: disable=invalid-name,E0401
"""Minimal setup.py for MODAPE - handles only Cython extensions"""
from setuptools import setup, Extension
import numpy
USE_CYTHON = "auto"
if USE_CYTHON:
try:
from Cython.Distutils import build_ext
if USE_CYTHON == "auto":
USE_CYTHON = True
except ImportError:
if USE_CYTHON == "auto":
USE_CYTHON = False
else:
raise
cmdclass = {}
ext_modules = []
if USE_CYTHON:
ext_modules += [
Extension("modape.whittaker",
["modape/_whittaker.pyx"],
extra_compile_args=["-O3", "-ffast-math"],
include_dirs=[numpy.get_include()])]
cmdclass.update({"build_ext": build_ext})
else:
ext_modules += [
Extension("modape.whittaker",
["modape/_whittaker.c"],
extra_compile_args=["-O3", "-ffast-math"],
include_dirs=[numpy.get_include()])]
# Set Python 3 for Cython
for ext in ext_modules:
ext.cython_directives = {"language_level": "3"}
# Only handle extensions - all other config in pyproject.toml
setup(
cmdclass=cmdclass,
ext_modules=ext_modules,
)