MCPcopy Create free account
hub / github.com/numpy/numpy / generate_cython

Function generate_cython

setup.py:315–349  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

313 return new_build_clib, new_build_ext
314
315def generate_cython():
316 # Check Cython version
317 from numpy._utils import _pep440
318 try:
319 # try the cython in the installed python first (somewhat related to
320 # scipy/scipy#2397)
321 import Cython
322 from Cython.Compiler.Version import version as cython_version
323 except ImportError as e:
324 # The `cython` command need not point to the version installed in the
325 # Python running this script, so raise an error to avoid the chance of
326 # using the wrong version of Cython.
327 msg = 'Cython needs to be installed in Python as a module'
328 raise OSError(msg) from e
329 else:
330 # Note: keep in sync with that in pyproject.toml
331 # Update for Python 3.11
332 required_version = '0.29.30'
333
334 if _pep440.parse(cython_version) < _pep440.Version(required_version):
335 cython_path = Cython.__file__
336 msg = 'Building NumPy requires Cython >= {}, found {} at {}'
337 msg = msg.format(required_version, cython_version, cython_path)
338 raise RuntimeError(msg)
339
340 # Process files
341 cwd = os.path.abspath(os.path.dirname(__file__))
342 print("Cythonizing sources")
343 for d in ('random',):
344 p = subprocess.call([sys.executable,
345 os.path.join(cwd, 'tools', 'cythonize.py'),
346 'numpy/{0}'.format(d)],
347 cwd=cwd)
348 if p != 0:
349 raise RuntimeError("Running cythonize failed!")
350
351
352def parse_setuppy_commands():

Callers 1

setup_packageFunction · 0.85

Calls 4

printFunction · 0.85
parseMethod · 0.45
abspathMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected