From 9a303ce55632225fa1b884461c133b1caf00a387 Mon Sep 17 00:00:00 2001 From: Christian Tismer Date: Sat, 24 Feb 2018 17:40:50 +0100 Subject: setup.py: Distinguish debug/release Python When developing the heap types, I had to switch between debug and release Python very often. This patch allows for debug and release to co-exist without re-building everything. Additionally to the 'd' that gets appended to the build and install folders, I used a 'p' for debug Python. Please feel free to change that as you like. Change-Id: I022face5177bb69589809c8b235f09161d7fabd2 Reviewed-by: Friedemann Kleint --- setup.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 03e8d7800..d78197440 100644 --- a/setup.py +++ b/setup.py @@ -402,6 +402,9 @@ Use --list-versions option to get list of available versions""" % OPTION_VERSION sys.exit(1) __version__ = OPTION_VERSION +def is_debug_python(): + return getattr(sys, "gettotalrefcount", None) is not None + # Return a prefix suitable for the _install/_build directory def prefix(): virtualEnvName = os.environ.get('VIRTUAL_ENV', None) @@ -409,6 +412,8 @@ def prefix(): name += str(sys.version_info[0]) if OPTION_DEBUG: name += 'd' + if is_debug_python(): + name += 'p' return name # Initialize, pull and checkout submodules -- cgit v1.2.3