From 24637421ec9bdf92b0faba3a9d3fe1df6d9ac94d Mon Sep 17 00:00:00 2001 From: Benjamin Schubert Date: Mon, 3 Jun 2019 10:33:13 +0100 Subject: setup.py: Be more restrictive with BST_CYTHON_TRACE values "0" evaluates to 'True' in python, which incorrectly switched on the BST_CYTHON_TRACE. Forcing an int for this environment variable allows us to ensure we are correct. --- setup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index ad87932fb..ed211dd09 100755 --- a/setup.py +++ b/setup.py @@ -324,7 +324,12 @@ def assert_cython_required(): raise SystemExit(1) -ENABLE_CYTHON_TRACE = os.environ.get("BST_CYTHON_TRACE", "0") +try: + ENABLE_CYTHON_TRACE = int(os.environ.get("BST_CYTHON_TRACE", "0")) +except ValueError: + print("BST_CYTHON_TRACE must be an integer. Please set it to '1' to enable, '0' to disable", file=sys.stderr) + raise SystemExit(1) + extension_macros = [ ("CYTHON_TRACE", ENABLE_CYTHON_TRACE) -- cgit v1.2.1