From efbba71b53af150e56749a1eea92c19ca42cc82c Mon Sep 17 00:00:00 2001 From: JinWang An Date: Mon, 27 Mar 2023 17:02:41 +0900 Subject: [PATCH] Imported Upstream version 60.0.5 --- .bumpversion.cfg | 2 +- CHANGES.rst | 9 +++++++ setup.cfg | 2 +- setuptools/_distutils/command/install.py | 32 +++++++++++++++++------- 4 files changed, 34 insertions(+), 11 deletions(-) diff --git a/.bumpversion.cfg b/.bumpversion.cfg index ce25a8c..65eec0b 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 60.0.4 +current_version = 60.0.5 commit = True tag = True diff --git a/CHANGES.rst b/CHANGES.rst index 9145ac9..998dda4 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,3 +1,12 @@ +v60.0.5 +------- + + +Misc +^^^^ +* #2960: Install schemes fall back to default scheme for headers. + + v60.0.4 ------- diff --git a/setup.cfg b/setup.cfg index 08eefc4..f1a6fc5 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = setuptools -version = 60.0.4 +version = 60.0.5 author = Python Packaging Authority author_email = distutils-sig@python.org description = Easily download, build, install, upgrade, and uninstall Python packages diff --git a/setuptools/_distutils/command/install.py b/setuptools/_distutils/command/install.py index 4f94472..6584492 100644 --- a/setuptools/_distutils/command/install.py +++ b/setuptools/_distutils/command/install.py @@ -81,11 +81,6 @@ if HAS_USER_SITE: 'data' : '{userbase}', } - INSTALL_SCHEMES['osx_framework_user'] = { - 'headers': - '{userbase}/include/{implementation_lower}{py_version_short}{abiflags}/{dist_name}', - } - # The keys to an installation scheme; if any new types of files are to be # installed, be sure to add an entry to every installation scheme above, # and to SCHEME_KEYS here. @@ -124,7 +119,8 @@ def _get_implementation(): def _select_scheme(ob, name): - vars(ob).update(_remove_set(ob, _scheme_attrs(_resolve_scheme(name)))) + scheme = _inject_headers(name, _load_scheme(_resolve_scheme(name))) + vars(ob).update(_remove_set(ob, _scheme_attrs(scheme))) def _remove_set(ob, attrs): @@ -147,9 +143,26 @@ def _resolve_scheme(name): return resolved -def _scheme_attrs(name): +def _load_scheme(name): + return _load_schemes()[name] + + +def _inject_headers(name, scheme): + """ + Given a scheme name and the resolved scheme, + if the scheme does not include headers, resolve + the fallback scheme for the name and use headers + from it. pypa/distutils#88 + """ + # Bypass the preferred scheme, which may not + # have defined headers. + fallback = _load_scheme(_pypy_hack(name)) + scheme.setdefault('headers', fallback['headers']) + return scheme + + +def _scheme_attrs(scheme): """Resolve install directories by applying the install schemes.""" - scheme = _load_schemes()[name] return { f'install_{key}': scheme[key] for key in SCHEME_KEYS @@ -395,7 +408,8 @@ class install(Command): 'platlibdir': getattr(sys, 'platlibdir', 'lib'), 'implementation_lower': _get_implementation().lower(), 'implementation': _get_implementation(), - 'platsubdir': sysconfig.get_config_var('platsubdir'), + # all values must be str; see #86 + 'platsubdir': str(sysconfig.get_config_var('platsubdir')), } if HAS_USER_SITE: -- 2.34.1