summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenjamin Schubert <ben.c.schubert@gmail.com>2019-05-31 11:38:46 +0100
committerBenjamin Schubert <ben.c.schubert@gmail.com>2019-05-31 11:41:52 +0100
commita8e252c05fe4afcf772cca41fb5a4c6873697daf (patch)
tree0023fac6e94f7fbccdc88248d542b7dbb8b29320
parentfd91071fd2666f54f6beb967d6762415525e3e56 (diff)
downloadbuildstream-bschubert/cython-disable-linetrace.tar.gz
Setup.py: Disable linetrace by default and only enable when using coveragebschubert/cython-disable-linetrace
It turns out that enabling 'linetrace', does have a runtime cost even if not enabled in distutils. Therefore disabling it by default. In order to run coverage, we therefore need to retranspile the .pyx files with ENABLE_CYTHON_TRACE set.
-rwxr-xr-xsetup.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/setup.py b/setup.py
index a57e65b56..f4d9d9908 100755
--- a/setup.py
+++ b/setup.py
@@ -324,8 +324,10 @@ def assert_cython_required():
raise SystemExit(1)
+ENABLE_CYTHON_TRACE = os.environ.get("BST_CYTHON_TRACE", 0)
+
extension_macros = [
- ("CYTHON_TRACE", os.environ.get("BST_CYTHON_TRACE", 0))
+ ("CYTHON_TRACE", ENABLE_CYTHON_TRACE)
]
@@ -458,9 +460,8 @@ setup(name='BuildStream',
# Version of python to use
# https://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html#arguments
"language_level": "3",
- # Enable line tracing, this is needed in order to generate coverage.
- # This is not enabled unless the CYTHON_TRACE macro for distutils is defined.
- "linetrace": True,
+ # Enable line tracing when requested only, this is needed in order to generate coverage.
+ "linetrace": bool(ENABLE_CYTHON_TRACE),
"profile": os.environ.get("BST_CYTHON_PROFILE", False),
}
),