8000 MAINT: Only allow using Cython module when cythonizing. · numpy/numpy@393a3a4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 393a3a4

Browse files
committed
MAINT: Only allow using Cython module when cythonizing.
The command line version of `cython` may point to a different installation of Cython than that installed in the Python running the cythonize script. Because the Cython version can be critical, requiring that the cython used comes from a known place makes it less likely that the wrong version will be used. This treats Cython as a build dependency rather than a free standing compiler.
1 parent 6177cbe commit 393a3a4

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

tools/cythonize.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,10 @@ def process_pyx(fromfile, tofile):
6060
# try the cython in the installed python first (somewhat related to scipy/scipy#2397)
6161
from Cython.Compiler.Version import version as cython_version
6262
except ImportError:
63-
# if that fails, use the one on the path, which might be the wrong version
64-
try:
65-
# Try the one on the path as a last resort
66-
subprocess.check_call(
67-
['cython'] + flags + ["-o", tofile, fromfile])
68-
except OSError:
69-
raise OSError('Cython needs to be installed')
63+
# The `cython` command need not point to the version installed in the
64+
# Python running this script, so raise an error to avoid the chance of
65+
# using the wrong version of Cython.
66+
raise OSError('Cython needs to be installed in Python as a module')
7067
else:
7168
# check the version, and invoke through python
7269
from distutils.version import LooseVersion

0 commit comments

Comments
 (0)
0