MCPcopy
hub / github.com/pandas-dev/pandas / maybe_cythonize

Function maybe_cythonize

setup.py:394–424  ·  view source on GitHub ↗

Render tempita templates before calling cythonize. This is skipped for * clean * sdist

(extensions, *args, **kwargs)

Source from the content-addressed store, hash-verified

392# TODO(cython#4518): Need to check to see if e.g. `linetrace` has changed and
393# possibly re-compile.
394def maybe_cythonize(extensions, *args, **kwargs):
395 """
396 Render tempita templates before calling cythonize. This is skipped for
397
398 * clean
399 * sdist
400 """
401 if "clean" in sys.argv or "sdist" in sys.argv:
402 # See https://github.com/cython/cython/issues/1495
403 return extensions
404
405 elif not _CYTHON_INSTALLED:
406 # GH#28836 raise a helpful error message
407 if _CYTHON_VERSION:
408 raise RuntimeError(
409 f"Cannot cythonize with old Cython version ({_CYTHON_VERSION} "
410 f"installed, needs {min_cython_ver})"
411 )
412 raise RuntimeError("Cannot cythonize without Cython installed.")
413
414 # reuse any parallel arguments provided for compilation to cythonize
415 parser = argparse.ArgumentParser()
416 parser.add_argument("--parallel", "-j", type=int, default=1)
417 parsed, _ = parser.parse_known_args()
418
419 kwargs["nthreads"] = parsed.parallel
420 build_ext.render_templates(_pxifiles)
421 if debugging_symbols_requested:
422 kwargs["gdb_debug"] = True
423
424 return cythonize(extensions, *args, **kwargs)
425
426
427def srcpath(name=None, suffix=".pyx", subdir="src"):

Callers 1

setup.pyFile · 0.85

Calls 1

render_templatesMethod · 0.80

Tested by

no test coverage detected