From 9a0a7ca5628b4bc9d4ad1a7bdffa9b20ee1efa6f Mon Sep 17 00:00:00 2001 From: Thomas Nagy Date: Sun, 28 Sep 2014 23:07:02 +0200 Subject: [PATCH] Added crutches for python-config detection on Python 2.5 --- ChangeLog | 1 + waflib/Tools/python.py | 16 +++++++++++----- waflib/fixpy2.py | 2 +- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 016947b7..1faced0c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,7 @@ NEW IN WAF 1.8.0 * Generic configuration tests * Better unicode handlig in scripts and in file names * Shorter build outputs +* Python 2.5 is now required for all functionality (compatibility with Python 2.4 is limited) NEW IN WAF 1.7.11 ----------------- diff --git a/waflib/Tools/python.py b/waflib/Tools/python.py index de2ae651..c84364cf 100644 --- a/waflib/Tools/python.py +++ b/waflib/Tools/python.py @@ -269,17 +269,23 @@ def check_python_headers(conf): num = '.'.join(env['PYTHON_VERSION'].split('.')[:2]) conf.find_program([''.join(pybin) + '-config', 'python%s-config' % num, 'python-config-%s' % num, 'python%sm-config' % num], var='PYTHON_CONFIG', msg="python-config") - flags = ['--cflags', '--libs', '--ldflags'] + # oh great, python2.5-config requires 3 runs + all_flags = [['--cflags', '--libs', '--ldflags']] + if sys.hexversion < 0x2060000: + all_flags = [[x] for x in all_flags[0]] + xx = conf.env.CXX_NAME and 'cxx' or 'c' - conf.check_cfg(msg='Asking python-config for pyembed %r flags' % ' '.join(flags), - path=conf.env.PYTHON_CONFIG, package='', uselib_store='PYEMBED', args=flags) + for flags in all_flags: + conf.check_cfg(msg='Asking python-config for pyembed %r flags' % ' '.join(flags), path=conf.env.PYTHON_CONFIG, package='', uselib_store='PYEMBED', args=flags) + conf.check(header_name='Python.h', define_name='HAVE_PYEMBED', msg='Getting pyembed flags from python-config', fragment=FRAG, errmsg='Could not build a python embedded interpreter', features='%s %sprogram pyembed' % (xx, xx)) - conf.check_cfg(msg='Asking python-config for pyext %r flags' % ' '.join(flags), - path=conf.env.PYTHON_CONFIG, package='', uselib_store='PYEXT', args=flags) + for flags in all_flags: + conf.check_cfg(msg='Asking python-config for pyext %r flags' % ' '.join(flags), path=conf.env.PYTHON_CONFIG, package='', uselib_store='PYEXT', args=flags) + conf.check(header_name='Python.h', define_name='HAVE_PYEXT', msg='Getting pyext flags from python-config', features='%s %sshlib pyext' % (xx, xx), fragment=FRAG, errmsg='Could not build python extensions') diff --git a/waflib/fixpy2.py b/waflib/fixpy2.py index 4240c9bc..5e9ee3e0 100644 --- a/waflib/fixpy2.py +++ b/waflib/fixpy2.py @@ -58,7 +58,7 @@ def subst(*k): @subst('*') def r3(code): - if sys.hexversion < 0x2500000: + if sys.hexversion < 0x2050000: code = code.replace(',extra={', ') #extra={') return code