Python sysconfig variable 'SO' is deprecated

The new variable 'EXT_SUFFIX' was introduced with Python 3 with the old
'SO' variable scheduled for deprecation in Python 3.4. The actual
deprecation warning apparently was introduced in Python 3.7.
This commit is contained in:
Severin Strobl 2022-01-13 19:11:54 +01:00
parent 6c81b4a3dd
commit 018288e258
1 changed files with 3 additions and 3 deletions

View File

@ -315,7 +315,8 @@ def check_python_headers(conf, features='pyembed pyext'):
conf.fatal('Could not find the python executable')
# so we actually do all this for compatibility reasons and for obtaining pyext_PATTERN below
v = 'prefix SO LDFLAGS LIBDIR LIBPL INCLUDEPY Py_ENABLE_SHARED MACOSX_DEPLOYMENT_TARGET LDSHARED CFLAGS LDVERSION'.split()
v = 'prefix LDFLAGS LIBDIR LIBPL INCLUDEPY Py_ENABLE_SHARED MACOSX_DEPLOYMENT_TARGET LDSHARED CFLAGS LDVERSION'.split()
v.append('SO' if sys.hexversion < 0x03070000 else 'EXT_SUFFIX')
try:
lst = conf.get_python_variables(["get_config_var('%s') or ''" % x for x in v])
except RuntimeError:
@ -328,7 +329,7 @@ def check_python_headers(conf, features='pyembed pyext'):
x = 'MACOSX_DEPLOYMENT_TARGET'
if dct[x]:
env[x] = conf.environ[x] = str(dct[x])
env.pyext_PATTERN = '%s' + dct['SO'] # not a mistake
env.pyext_PATTERN = '%s' + dct['SO' if sys.hexversion < 0x03070000 else 'EXT_SUFFIX'] # not a mistake
# Try to get pythonX.Y-config
@ -646,4 +647,3 @@ def options(opt):
help='Installation path for python modules (py, platform-independent .py and .pyc files)')
pyopt.add_option('--pythonarchdir', dest='pythonarchdir',
help='Installation path for python extension (pyext, platform-dependent .so or .dylib files)')