-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
40 lines (31 loc) · 895 Bytes
/
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
import os
from setuptools import setup
from distutils.command.build_py import build_py
PACKAGE = "fisher"
class AfterBuildPy(build_py):
def build_c(self, path, filename):
obj_path = os.path.join(path, PACKAGE, "src", f"{filename}.so")
c_path = os.path.join(path, PACKAGE, "src", f"{filename}.c")
ret = os.system(
f"gcc -o {obj_path} -shared -fPIC {c_path}"
)
if ret != 0:
raise Exception("gcc build failed.")
def run(self):
build_py.run(self)
installed_path = self.build_lib
self.build_c(installed_path, "fisher")
self.build_c(installed_path, "asa159")
setup(
install_requires=[
"numpy",
"scipy"
],
test_suite="tests",
tests_require=["pytest"],
packages=["fisher"],
package_data={
PACKAGE: ["src/*.c", "src/asa159.so", "src/fisher.so"]
},
cmdclass={"build_py": AfterBuildPy},
)