From a53dc99ce18748ab9008507a1b4f99df3283ea02 Mon Sep 17 00:00:00 2001 From: DongHun Kwak Date: Wed, 30 Dec 2020 07:08:40 +0900 Subject: [PATCH] Imported Upstream version 50.0.3 --- .bumpversion.cfg | 2 +- CHANGES.rst | 6 +++++ docs/conf.py | 6 ++++- setup.cfg | 2 +- setuptools/_distutils/command/build_ext.py | 3 ++- setuptools/_distutils/command/py37compat.py | 30 +++++++++++++++++++++ 6 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 setuptools/_distutils/command/py37compat.py diff --git a/.bumpversion.cfg b/.bumpversion.cfg index e297316..e85c79b 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 50.0.2 +current_version = 50.0.3 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 435a7b4..8f19261 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,9 @@ +v50.0.3 +------- + +* #2363: Restore link_libpython support on Python 3.7 and earlier (see pypa/distutils#9). + + v50.0.2 ------- diff --git a/docs/conf.py b/docs/conf.py index b92b50c..1252058 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -101,7 +101,7 @@ link_files = { url='http://bugs.jython.org/issue{jython}', ), dict( - pattern=r'Python #(?P\d+)', + pattern=r'(Python #|bpo-)(?P\d+)', url='http://bugs.python.org/issue{python}', ), dict( @@ -128,6 +128,10 @@ link_files = { pattern=r'setuptools_svn #(?P\d+)', url='{GH}/jaraco/setuptools_svn/issues/{setuptools_svn}', ), + dict( + pattern=r'pypa/distutils#(?P\d+)', + url='{GH}/pypa/distutils/issues/{distutils}', + ), dict( pattern=r'^(?m)((?Pv?\d+(\.\d+){1,2}))\n[-=]+\n', with_scm='{text}\n{rev[timestamp]:%d %b %Y}\n', diff --git a/setup.cfg b/setup.cfg index 0101bb8..7236ae4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -16,7 +16,7 @@ formats = zip [metadata] name = setuptools -version = 50.0.2 +version = 50.0.3 description = Easily download, build, install, upgrade, and uninstall Python packages author = Python Packaging Authority author_email = distutils-sig@python.org diff --git a/setuptools/_distutils/command/build_ext.py b/setuptools/_distutils/command/build_ext.py index 1a9bd12..bbb3483 100644 --- a/setuptools/_distutils/command/build_ext.py +++ b/setuptools/_distutils/command/build_ext.py @@ -16,6 +16,7 @@ from distutils.dep_util import newer_group from distutils.extension import Extension from distutils.util import get_platform from distutils import log +from . import py37compat from site import USER_BASE @@ -751,4 +752,4 @@ class build_ext(Command): ldversion = get_config_var('LDVERSION') return ext.libraries + ['python' + ldversion] - return ext.libraries + return ext.libraries + py37compat.pythonlib() diff --git a/setuptools/_distutils/command/py37compat.py b/setuptools/_distutils/command/py37compat.py new file mode 100644 index 0000000..754715a --- /dev/null +++ b/setuptools/_distutils/command/py37compat.py @@ -0,0 +1,30 @@ +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 +) -- 2.34.1