Skip to content

Commit 960ba52

Browse files
authored
Refactor extension module definitions in setup.py
Separate Cython and C extension modules for clarity.
1 parent b222ea5 commit 960ba52

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

setup.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,44 @@
1-
# setup.py
21
import sys
32
from setuptools import setup, Extension
43
from setuptools.command.build_ext import build_ext
54
from Cython.Build import cythonize
65

7-
86
class CustomBuildExt(build_ext):
97
def finalize_options(self):
108
super().finalize_options()
119
import numpy as np
1210
self.include_dirs.append(np.get_include())
1311

14-
1512
if sys.platform == "win32":
1613
c_args = ["/O2"]
1714
else:
1815
c_args = ["-O3"]
1916

20-
21-
ext_modules = [
17+
pyx_extensions = [
2218
Extension("classix.aggregate_ed_c", ["classix/aggregate_ed_c.pyx"], extra_compile_args=c_args),
2319
Extension("classix.aggregate_ed_cm", ["classix/aggregate_ed_cm.pyx"], extra_compile_args=c_args),
2420
Extension("classix.merge_ed_cm", ["classix/merge_ed_cm.pyx"], extra_compile_args=c_args),
2521
Extension("classix.merge_ed_cm_win", ["classix/merge_ed_cm_win.pyx"], extra_compile_args=c_args),
26-
2722
Extension("classix.aggregate_md_cm", ["classix/aggregate_md_cm.pyx"], extra_compile_args=c_args),
2823
Extension("classix.merge_md_cm", ["classix/merge_md_cm.pyx"], extra_compile_args=c_args),
29-
3024
Extension(
3125
"classix.aggregate_td_cm",
3226
["classix/aggregate_td_cm.pyx"],
3327
language="c++",
3428
extra_compile_args=c_args,
3529
),
36-
3730
Extension("classix.merge_td_cm", ["classix/merge_td_cm.pyx"], extra_compile_args=c_args),
31+
]
3832

33+
c_extensions = [
3934
Extension("spmv", ["classix/spmv.c"], extra_compile_args=c_args),
4035
]
4136

42-
4337
setup(
4438
ext_modules=cythonize(
45-
ext_modules,
39+
pyx_extensions,
4640
compiler_directives={"language_level": "3"},
4741
annotate=False,
48-
),
42+
) + c_extensions,
4943
cmdclass={"build_ext": CustomBuildExt},
5044
)
51-

0 commit comments

Comments
 (0)