Commit 526b7fe0 authored by Jason R. Coombs's avatar Jason R. Coombs Committed by GitHub

Merge pull request #10 from pypa/bugfix/9-legacy-link-libpython

Restore pythonlib support on older Pythons.
parents 5ab258b9 97a8f11a
...@@ -16,6 +16,7 @@ from distutils.dep_util import newer_group ...@@ -16,6 +16,7 @@ from distutils.dep_util import newer_group
from distutils.extension import Extension from distutils.extension import Extension
from distutils.util import get_platform from distutils.util import get_platform
from distutils import log from distutils import log
from . import py37compat
from site import USER_BASE from site import USER_BASE
...@@ -751,4 +752,4 @@ class build_ext(Command): ...@@ -751,4 +752,4 @@ class build_ext(Command):
ldversion = get_config_var('LDVERSION') ldversion = get_config_var('LDVERSION')
return ext.libraries + ['python' + ldversion] return ext.libraries + ['python' + ldversion]
return ext.libraries return ext.libraries + py37compat.pythonlib()
import sys
def _pythonlib_compat():
"""
On Python 3.7 and earlier, distutils would include the Python
library. See pypa/distutils#9.
"""
from distutils import sysconfig
if not sysconfig.get_config_var('Py_ENABLED_SHARED'):
return
yield 'python{}.{}{}'.format(
sys.hexversion >> 24,
(sys.hexversion >> 16) & 0xff,
sysconfig.get_config_var('ABIFLAGS'),
)
def compose(f1, f2):
return lambda *args, **kwargs: f1(f2(*args, **kwargs))
pythonlib = (
compose(list, _pythonlib_compat)
if sys.version_info < (3, 8)
and sys.platform != 'darwin'
and sys.platform[:3] != 'aix'
else list
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment