diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2021-11-12 16:06:47 -0500 |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2021-11-12 16:06:47 -0500 |
commit | 342e02e7a4dbedf0e3a04c4d2d213b5340d56010 (patch) | |
tree | 71f1098520fc8b21e56fe7d553d6cc37f660927c | |
parent | 69b850303420cf47d41d6e6f47ed07a3e2dd4516 (diff) | |
download | python-setuptools-git-342e02e7a4dbedf0e3a04c4d2d213b5340d56010.tar.gz |
Rename 'posix' to 'unix' to match sysconfig. Merge both definitions with sysconfig.
-rw-r--r-- | distutils/command/install.py | 30 | ||||
-rw-r--r-- | distutils/tests/test_install.py | 2 |
2 files changed, 20 insertions, 12 deletions
diff --git a/distutils/command/install.py b/distutils/command/install.py index dd313d8a..c756b6db 100644 --- a/distutils/command/install.py +++ b/distutils/command/install.py @@ -6,6 +6,7 @@ import sys import os import contextlib import sysconfig +import itertools from distutils import log from distutils.core import Command @@ -30,14 +31,14 @@ WINDOWS_SCHEME = { } INSTALL_SCHEMES = { - 'unix_prefix': { + 'posix_prefix': { 'purelib': '{base}/lib/{implementation_lower}{py_version_short}/site-packages', 'platlib': '{platbase}/{platlibdir}/{implementation_lower}{py_version_short}/site-packages', 'headers': '{base}/include/{implementation_lower}{py_version_short}{abiflags}/{dist_name}', 'scripts': '{base}/bin', 'data' : '{base}', }, - 'unix_home': { + 'posix_home': { 'purelib': '{base}/lib/{implementation_lower}', 'platlib': '{base}/{platlibdir}/{implementation_lower}', 'headers': '{base}/include/{implementation_lower}/{dist_name}', @@ -71,7 +72,7 @@ if HAS_USER_SITE: 'data' : '{userbase}', } - INSTALL_SCHEMES['unix_user'] = { + INSTALL_SCHEMES['posix_user'] = { 'purelib': '{usersite}', 'platlib': '{usersite}', 'headers': @@ -86,21 +87,28 @@ if HAS_USER_SITE: SCHEME_KEYS = ('purelib', 'platlib', 'headers', 'scripts', 'data') +def _load_sysconfig_schemes(): + with contextlib.suppress(AttributeError): + return { + scheme: sysconfig.get_paths(scheme, expand=False) + for scheme in sysconfig.get_scheme_names() + } + + def _load_schemes(): """ Extend default schemes with schemes from sysconfig. """ - schemes = dict(INSTALL_SCHEMES) + sysconfig_schemes = _load_sysconfig_schemes() or {} - with contextlib.suppress(AttributeError): - sysconfig_schemes = { - scheme: sysconfig.get_paths(scheme, expand=False) - for scheme in sysconfig.get_scheme_names() + return { + scheme: { + **INSTALL_SCHEMES.get(scheme, {}), + **sysconfig_schemes.get(scheme, {}), } - schemes.update(sysconfig_schemes) - - return schemes + for scheme in set(itertools.chain(INSTALL_SCHEMES, sysconfig_schemes)) + } def _get_implementation(): diff --git a/distutils/tests/test_install.py b/distutils/tests/test_install.py index eb684a09..cce973dc 100644 --- a/distutils/tests/test_install.py +++ b/distutils/tests/test_install.py @@ -94,7 +94,7 @@ class InstallTestCase(support.TempdirManager, self.addCleanup(cleanup) - for key in ('nt_user', 'unix_user'): + for key in ('nt_user', 'posix_user'): self.assertIn(key, INSTALL_SCHEMES) dist = Distribution({'name': 'xx'}) |