mirror of https://github.com/pypa/pip
install_lib should take precedence when reading distutils config.
This commit is contained in:
parent
1f64f882e1
commit
3affcaa2b8
|
@ -179,6 +179,10 @@ def distutils_scheme(dist_name, user=False, home=None, root=None):
|
|||
for key in SCHEME_KEYS:
|
||||
scheme[key] = getattr(i, 'install_' + key)
|
||||
|
||||
if i.install_lib is not None:
|
||||
# install_lib takes precedence over purelib and platlib
|
||||
scheme.update(dict(purelib=i.install_lib, platlib=i.install_lib))
|
||||
|
||||
if running_under_virtualenv():
|
||||
scheme['headers'] = os.path.join(
|
||||
sys.prefix,
|
||||
|
|
|
@ -180,3 +180,17 @@ class TestDisutilsScheme:
|
|||
)
|
||||
scheme = distutils_scheme('example')
|
||||
assert scheme['scripts'] == '/somewhere/else'
|
||||
|
||||
def test_install_lib_takes_precedence(self, tmpdir, monkeypatch):
|
||||
f = tmpdir.mkdir("config").join("setup.cfg")
|
||||
f.write("[install]\ninstall-lib=/somewhere/else/")
|
||||
from distutils.dist import Distribution
|
||||
# patch the function that returns what config files are present
|
||||
monkeypatch.setattr(
|
||||
Distribution,
|
||||
'find_config_files',
|
||||
lambda self: [f],
|
||||
)
|
||||
scheme = distutils_scheme('example')
|
||||
assert scheme['platlib'] == '/somewhere/else/'
|
||||
assert scheme['purelib'] == '/somewhere/else/'
|
||||
|
|
Loading…
Reference in New Issue