diff options
| author | Jason R. Coombs <jaraco@jaraco.com> | 2021-12-23 11:06:17 -0500 |
|---|---|---|
| committer | Jason R. Coombs <jaraco@jaraco.com> | 2021-12-23 11:06:17 -0500 |
| commit | e3f53f93af07a0e04bfa7b853b3ba2795b349c90 (patch) | |
| tree | 8aea3d544ea08c0ed56bd3a0202c57a0825b2543 | |
| parent | 5ed4fe50f31641937adf1da1a3f578365661b87e (diff) | |
| download | python-setuptools-git-e3f53f93af07a0e04bfa7b853b3ba2795b349c90.tar.gz | |
When headers are missing in a preferred scheme, use the default scheme as a fallback to resolve headers. Workaround for and fixes #88.
| -rw-r--r-- | distutils/command/install.py | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/distutils/command/install.py b/distutils/command/install.py index fceb36aa..380564b0 100644 --- a/distutils/command/install.py +++ b/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 |
