-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsetup.py
More file actions
32 lines (27 loc) · 918 Bytes
/
setup.py
File metadata and controls
32 lines (27 loc) · 918 Bytes
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
#!/usr/bin/env python
"""Minimal setup.py for Cython extensions only."""
from Cython.Build import cythonize
from setuptools import Extension, setup
from setuptools.command.build_ext import build_ext
COMPILE_ARGS = ["-O3"]
extensions = [
Extension(
name='asyncdb.utils.types',
sources=['asyncdb/utils/types.pyx'],
extra_compile_args=COMPILE_ARGS,
language="c++"
),
]
class BuildExtensions(build_ext):
"""Custom build_ext command to ensure cythonization during the build step."""
def build_extensions(self):
try:
self.extensions = cythonize(self.extensions)
except ImportError:
print("Cython not found. Extensions will be compiled without cythonization!")
super().build_extensions()
if __name__ == "__main__":
setup(
ext_modules=cythonize(extensions),
cmdclass={"build_ext": BuildExtensions},
)