summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorStefan Behnel <stefan_ml@behnel.de>2021-05-14 20:06:20 +0200
committerStefan Behnel <stefan_ml@behnel.de>2021-05-14 20:06:20 +0200
commit0448bfbb9a1845a3cca5d07a32fdd4590f538713 (patch)
treed2acb233d0cb2e21008a36b4c8d9015d1ef92388 /setup.py
parentc9cccfeaf3f0e20c2bb14fc234e86f4fc8e4fe81 (diff)
downloadcython-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-xsetup.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/setup.py b/setup.py
index d9d98e66e..ef9878955 100755
--- a/setup.py
+++ b/setup.py
@@ -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(