Python 3.8 has different flags for pyembed, needs --embed

As recommended in the docs, to support both 3.8 and
previous versions, we try to use python3-config --embed and
fallback to the previous behavior.

Fixes https://gitlab.com/ita1024/waf/issues/2239

See https://docs.python.org/dev/whatsnew/3.8.html#debug-build-uses-the-same-abi-as-release-build
This commit is contained in:
Miro Hrončok 2019-05-24 11:49:58 +02:00
parent b1ac2bc686
commit 38d1cbeba4
1 changed files with 7 additions and 1 deletions

View File

@ -342,7 +342,13 @@ def check_python_headers(conf, features='pyembed pyext'):
if 'pyembed' in features:
for flags in all_flags:
conf.check_cfg(msg='Asking python-config for pyembed %r flags' % ' '.join(flags), path=env.PYTHON_CONFIG, package='', uselib_store='PYEMBED', args=flags)
# Python 3.8 has different flags for pyembed, needs --embed
embedflags = flags + ['--embed']
try:
conf.check_cfg(msg='Asking python-config for pyembed %r flags' % ' '.join(embedflags), path=env.PYTHON_CONFIG, package='', uselib_store='PYEMBED', args=embedflags)
except conf.errors.ConfigurationError:
# However Python < 3.8 doesn't accept --embed, so we need a fallback
conf.check_cfg(msg='Asking python-config for pyembed %r flags' % ' '.join(flags), path=env.PYTHON_CONFIG, package='', uselib_store='PYEMBED', args=flags)
try:
conf.test_pyembed(xx)