-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
38 lines (31 loc) · 1.19 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
import numpy as np
from setuptools import setup
from setuptools.extension import Extension
from Cython.Build import cythonize
# See https://stackoverflow.com/a/60751886/3251234 for how this could be configured
# to install numpy and/or Cython on a system that lacks them. One provides a
# cmdclass={"build": build}, to setup, where `build` is a subclass that imports
# these packages only after they have been installed.
if __name__ == "__main__":
def ext(name):
path = name.replace(".", "/")
sources = [path + ".pyx"]
return Extension(name, sources=sources, include_dirs=[np.get_include()])
cython_extensions = [
"mass.core.cython_channel",
"mass.core.analysis_algorithms",
"mass.mathstat.robust",
"mass.mathstat.entropy",
]
extensions = []
package_data = {}
for name in cython_extensions:
module, fname = name.rsplit(".", 1)
extensions.append(ext(name))
sources = package_data.get(module, [])
sources.append(fname)
package_data[module] = sources
setup(
ext_modules=cythonize(extensions, compiler_directives={'language_level': "3"}),
package_data=package_data,
)