-
Notifications
You must be signed in to change notification settings - Fork 51
/
setup.py
49 lines (40 loc) · 1.32 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
#!/usr/bin/env python
from setuptools import setup, Extension, find_packages
from Cython.Build import cythonize
import os.path
with open("README.rst", "r") as f:
long_description = f.read()
# Build cython files as extensions
def build_extensions(pkg_name, major_submodules):
cwd = os.path.abspath(os.path.dirname(__file__))
extensions = []
for subm in major_submodules:
for f in os.listdir(os.path.join(cwd, pkg_name, subm.replace(".", "/"))):
if f.endswith(".pyx"):
filename = os.path.splitext(f)[0]
ext_name = f"{pkg_name}.{subm}.{filename}"
ext_path = os.path.join(pkg_name, subm.replace(".", "/"), f)
extensions.append(Extension(ext_name, [ext_path]))
return extensions
extensions = build_extensions(
"pomdp_py",
[
"framework",
"algorithms",
"utils",
"representations.distribution",
"representations.belief",
"problems.tiger.cythonize",
"problems.rocksample.cythonize",
],
)
setup(
ext_modules=cythonize(
extensions, build_dir="build", compiler_directives={"language_level": "3"}
),
packages=find_packages(exclude=["thirdparty", "thirdparty.*"]),
package_data={
"pomdp_py": ["*.pxd", "*.pyx", "*.so", "*.c"],
},
zip_safe=False,
)