Skip to content

Commit 5aa8572

Browse files
committed
Merge https://github.com/pypa/distutils into bugfix/distutils88
2 parents 52c9901 + 9867e2e commit 5aa8572

1 file changed

Lines changed: 23 additions & 9 deletions

File tree

setuptools/_distutils/command/install.py

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,6 @@
8181
'data' : '{userbase}',
8282
}
8383

84-
INSTALL_SCHEMES['osx_framework_user'] = {
85-
'headers':
86-
'{userbase}/include/{implementation_lower}{py_version_short}{abiflags}/{dist_name}',
87-
}
88-
8984
# The keys to an installation scheme; if any new types of files are to be
9085
# installed, be sure to add an entry to every installation scheme above,
9186
# and to SCHEME_KEYS here.
@@ -124,7 +119,8 @@ def _get_implementation():
124119

125120

126121
def _select_scheme(ob, name):
127-
vars(ob).update(_remove_set(ob, _scheme_attrs(_resolve_scheme(name))))
122+
scheme = _inject_headers(name, _load_scheme(_resolve_scheme(name)))
123+
vars(ob).update(_remove_set(ob, _scheme_attrs(scheme)))
128124

129125

130126
def _remove_set(ob, attrs):
@@ -147,9 +143,26 @@ def _resolve_scheme(name):
147143
return resolved
148144

149145

150-
def _scheme_attrs(name):
146+
def _load_scheme(name):
147+
return _load_schemes()[name]
148+
149+
150+
def _inject_headers(name, scheme):
151+
"""
152+
Given a scheme name and the resolved scheme,
153+
if the scheme does not include headers, resolve
154+
the fallback scheme for the name and use headers
155+
from it. pypa/distutils#88
156+
"""
157+
# Bypass the preferred scheme, which may not
158+
# have defined headers.
159+
fallback = _load_scheme(_pypy_hack(name))
160+
scheme.setdefault('headers', fallback['headers'])
161+
return scheme
162+
163+
164+
def _scheme_attrs(scheme):
151165
"""Resolve install directories by applying the install schemes."""
152-
scheme = _load_schemes()[name]
153166
return {
154167
f'install_{key}': scheme[key]
155168
for key in SCHEME_KEYS
@@ -395,7 +408,8 @@ def finalize_options(self):
395408
'platlibdir': getattr(sys, 'platlibdir', 'lib'),
396409
'implementation_lower': _get_implementation().lower(),
397410
'implementation': _get_implementation(),
398-
'platsubdir': sysconfig.get_config_var('platsubdir'),
411+
# all values must be str; see #86
412+
'platsubdir': str(sysconfig.get_config_var('platsubdir')),
399413
}
400414

401415
if HAS_USER_SITE:

0 commit comments

Comments
 (0)