summaryrefslogtreecommitdiff
path: root/tools/cythonize.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/cythonize.py')
-rwxr-xr-xtools/cythonize.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/cythonize.py b/tools/cythonize.py
index 6cebf0f72..06cf54c9a 100755
--- a/tools/cythonize.py
+++ b/tools/cythonize.py
@@ -56,12 +56,14 @@ def process_pyx(fromfile, tofile):
try:
# try the cython in the installed python first (somewhat related to scipy/scipy#2397)
+ import Cython
from Cython.Compiler.Version import version as cython_version
- except ImportError:
+ except ImportError as e:
# The `cython` command need not point to the version installed in the
# Python running this script, so raise an error to avoid the chance of
# using the wrong version of Cython.
- raise OSError('Cython needs to be installed in Python as a module')
+ msg = 'Cython needs to be installed in Python as a module'
+ raise OSError(msg) from e
else:
# check the version, and invoke through python
from distutils.version import LooseVersion
@@ -73,7 +75,9 @@ def process_pyx(fromfile, tofile):
required_version = LooseVersion('0.29.21')
if LooseVersion(cython_version) < required_version:
- raise RuntimeError(f'Building {VENDOR} requires Cython >= {required_version}')
+ cython_path = Cython.__file__
+ raise RuntimeError(f'Building {VENDOR} requires Cython >= {required_version}'
+ f', found {cython_version} at {cython_path}')
subprocess.check_call(
[sys.executable, '-m', 'cython'] + flags + ["-o", tofile, fromfile])