-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathbuild_cython.py
More file actions
34 lines (29 loc) · 810 Bytes
/
Copy pathbuild_cython.py
File metadata and controls
34 lines (29 loc) · 810 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
33
34
import sys
from Cython.Build import cythonize
from setuptools import Extension
from setuptools.command.build_ext import build_ext
COMPILER_DIRECTIVES = {
"language_level": 3,
"cdivision": True,
"initializedcheck": False,
}
if sys.platform == "win32":
EXTRA_COMPILE_ARGS = ["/O2"]
else:
EXTRA_COMPILE_ARGS = ["-O3"]
def build(setup_kwargs):
setup_kwargs.update(
{
"ext_modules": cythonize(
[
Extension(
"asyncmy.*",
["asyncmy/*.pyx"],
extra_compile_args=EXTRA_COMPILE_ARGS,
),
],
compiler_directives=COMPILER_DIRECTIVES,
),
"cmdclass": {"build_ext": build_ext},
}
)