From db5a0fd0163fa2c27b080f921b66c86182fc241f Mon Sep 17 00:00:00 2001 From: tonysepia Date: Wed, 6 Jun 2018 16:20:17 +0200 Subject: [PATCH] Update setup.py Used a construct from here http://pythonextensionpatterns.readthedocs.io/en/latest/compiler_flags.html to differentiate between Debug and Production builds. --- setup.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 3eb382db..f5d174da 100644 --- a/setup.py +++ b/setup.py @@ -5,6 +5,15 @@ SOURCE_FILES = [os.path.join('http-parser', 'http_parser.c')] + \ sorted(glob.glob(os.path.join('bjoern', '*.c'))) +_DEBUG = False +if _DEBUG: + extra_compile_args = ['-std=c99', '-fno-strict-aliasing', '-fcommon', + '-fPIC', '-Wall', '-Wextra', '-Wno-unused-parameter', + '-Wno-missing-field-initializers', '-g'] +else: + extra_compile_args = ['-std=c99', '-fno-strict-aliasing', '-fcommon', + '-fPIC', '-Wall', '-g'] + bjoern_extension = Extension( '_bjoern', sources = SOURCE_FILES, @@ -12,9 +21,7 @@ include_dirs = ['http-parser', '/usr/include/libev'], define_macros = [('WANT_SENDFILE', '1'), ('WANT_SIGINT_HANDLING', '1')], - extra_compile_args = ['-std=c99', '-fno-strict-aliasing', '-fcommon', - '-fPIC', '-Wall', '-Wextra', '-Wno-unused-parameter', - '-Wno-missing-field-initializers', '-g'] + extra_compile_args=extra_compile_args ) setup(