-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.py
31 lines (26 loc) · 981 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
import os
from distutils.core import setup
from Cython.Build import cythonize
from distutils.extension import Extension
def make_extension(package_path, name, include_dirs=None):
if include_dirs is None:
include_dirs = []
cy_dir = os.path.join(*package_path)
package_prefix = '.'.join(package_path)+'.'
ext = Extension(package_prefix+name,
[os.path.join(cy_dir, name+'.pyx')],
include_dirs=include_dirs)
return ext
def discover_extensions(root_dir):
for (dirname, subdir, filenames) in os.walk(root_dir):
for filename in filenames:
if filename.endswith('.pyx'):
pkg = dirname.split(os.sep)
name = os.path.splitext(filename)[0]
yield make_extension(pkg, name)
#print(pkg, name)
extensions = list(discover_extensions('rlutil'))
extensions.extend(list(discover_extensions('debugq')))
setup(
ext_modules=cythonize(extensions)
)