1
1
Fork 0
mirror of https://github.com/pypa/pip synced 2023-12-13 21:30:23 +01:00

Merge pull request #8553 from uranusjr/header-location-prefix

Header location prefix
This commit is contained in:
Christopher Hunt 2020-07-07 21:37:50 -04:00 committed by GitHub
commit b27956928f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 1 deletions

3
news/8521.bugfix Normal file
View file

@ -0,0 +1,3 @@
Headers provided by wheels in .data directories are now correctly installed
into the user-provided locations, such as ``--prefix``, instead of the virtual
environment pip is running in.

View file

@ -138,7 +138,7 @@ def distutils_scheme(
if running_under_virtualenv():
scheme['headers'] = os.path.join(
sys.prefix,
i.prefix,
'include',
'site',
'python{}'.format(get_major_minor_version()),

View file

@ -130,3 +130,19 @@ class TestDistutilsScheme:
scheme = distutils_scheme('example')
assert scheme['platlib'] == install_lib + os.path.sep
assert scheme['purelib'] == install_lib + os.path.sep
def test_prefix_modifies_appropriately(self):
prefix = os.path.abspath(os.path.join('somewhere', 'else'))
normal_scheme = distutils_scheme("example")
prefix_scheme = distutils_scheme("example", prefix=prefix)
def _calculate_expected(value):
path = os.path.join(prefix, os.path.relpath(value, sys.prefix))
return os.path.normpath(path)
expected = {
k: _calculate_expected(v)
for k, v in normal_scheme.items()
}
assert prefix_scheme == expected