diff options
author | Stefan Behnel <stefan_ml@behnel.de> | 2021-05-14 20:06:20 +0200 |
---|---|---|
committer | Stefan Behnel <stefan_ml@behnel.de> | 2021-05-14 20:06:20 +0200 |
commit | 0448bfbb9a1845a3cca5d07a32fdd4590f538713 (patch) | |
tree | d2acb233d0cb2e21008a36b4c8d9015d1ef92388 /setup.py | |
parent | c9cccfeaf3f0e20c2bb14fc234e86f4fc8e4fe81 (diff) | |
download | cython-0448bfbb9a1845a3cca5d07a32fdd4590f538713.tar.gz |
Add a coverage test job with a compiled Cython package to compare plain Python and compiled Cython both for completeness and speed.
Diffstat (limited to 'setup.py')
-rwxr-xr-x | setup.py | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -79,7 +79,7 @@ else: scripts = ["cython.py", "cythonize.py", "cygdb.py"] -def compile_cython_modules(profile=False, compile_more=False, cython_with_refnanny=False): +def compile_cython_modules(profile=False, coverage=False, compile_more=False, cython_with_refnanny=False): source_root = os.path.abspath(os.path.dirname(__file__)) compiled_modules = [ "Cython.Plex.Scanners", @@ -135,6 +135,8 @@ def compile_cython_modules(profile=False, compile_more=False, cython_with_refnan defines = [] if cython_with_refnanny: defines.append(('CYTHON_REFNANNY', '1')) + if coverage: + defines.append(('CYTHON_TRACE', '1')) extensions = [] for module in compiled_modules: @@ -168,6 +170,9 @@ def compile_cython_modules(profile=False, compile_more=False, cython_with_refnan if profile: get_directive_defaults()['profile'] = True sys.stderr.write("Enabled profiling for the Cython binary modules\n") + if coverage: + get_directive_defaults()['linetrace'] = True + sys.stderr.write("Enabled line tracing and profiling for the Cython binary modules\n") # not using cythonize() directly to let distutils decide whether building extensions was requested add_command_class("build_ext", new_build_ext) @@ -178,6 +183,10 @@ cython_profile = '--cython-profile' in sys.argv if cython_profile: sys.argv.remove('--cython-profile') +cython_coverage = '--cython-coverage' in sys.argv +if cython_coverage: + sys.argv.remove('--cython-coverage') + try: sys.argv.remove("--cython-compile-all") cython_compile_more = True @@ -230,7 +239,7 @@ packages = [ def run_build(): if compile_cython_itself and (is_cpython or cython_compile_more): - compile_cython_modules(cython_profile, cython_compile_more, cython_with_refnanny) + compile_cython_modules(cython_profile, cython_coverage, cython_compile_more, cython_with_refnanny) from Cython import __version__ as version setup( |