Skip to content

Commit

Permalink
Add directive to ensure cython compiles in the correct python version
Browse files Browse the repository at this point in the history
  • Loading branch information
anxuae committed Oct 25, 2019
1 parent b579b62 commit 5a44be9
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion setuptools_cythonize.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""

import platform
import sys
from fnmatch import fnmatchcase
from distutils import log
from distutils.dist import Distribution
Expand Down Expand Up @@ -96,7 +97,15 @@ def run(self):
self.distribution.ext_modules = []
for (pkg, mod, pth) in build_py.find_all_modules(self):
if self.is_to_cythonize(pkg, mod):
self.distribution.ext_modules.append(Extension(".".join([pkg, mod]), [pth], cython_c_in_temp=True))
self.distribution.ext_modules.append(
Extension(
".".join([pkg, mod]),
[pth],
cython_c_in_temp=True,
# Ensure cython compiles with a relevent language mode setting
cython_directives={'language_level': sys.version[0]}
)
)

return build_py.run(self)

Expand Down

0 comments on commit 5a44be9

Please sign in to comment.