diff options
| author | Victor Stinner <vstinner@python.org> | 2020-03-10 09:53:09 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-10 09:53:09 +0100 |
| commit | 6e7341b2cb740741d77e0184db2b9028b1b93773 (patch) | |
| tree | fe0eca2a9eebd517565ef17daa39deb56f425ed0 | |
| parent | c6f749b2b761da2b88cac62d8c6aa29f7276e3a7 (diff) | |
| download | python-setuptools-git-6e7341b2cb740741d77e0184db2b9028b1b93773.tar.gz | |
bpo-1294959: Add sys.platlibdir attribute (GH-18381)
Add --with-platlibdir option to the configure script: name of the
platform-specific library directory, stored in the new sys.platlitdir
attribute. It is used to build the path of platform-specific dynamic
libraries and the path of the standard library.
It is equal to "lib" on most platforms. On Fedora and SuSE, it is
equal to "lib64" on 64-bit systems.
Co-Authored-By: Jan Matějek <jmatejek@suse.com>
Co-Authored-By: Matěj Cepl <mcepl@cepl.eu>
Co-Authored-By: Charalampos Stratakis <cstratak@redhat.com>
| -rw-r--r-- | command/install.py | 5 | ||||
| -rw-r--r-- | sysconfig.py | 11 | ||||
| -rw-r--r-- | tests/test_install.py | 3 |
3 files changed, 14 insertions, 5 deletions
diff --git a/command/install.py b/command/install.py index c625c95b..aaa300ef 100644 --- a/command/install.py +++ b/command/install.py @@ -30,14 +30,14 @@ WINDOWS_SCHEME = { INSTALL_SCHEMES = { 'unix_prefix': { 'purelib': '$base/lib/python$py_version_short/site-packages', - 'platlib': '$platbase/lib/python$py_version_short/site-packages', + 'platlib': '$platbase/$platlibdir/python$py_version_short/site-packages', 'headers': '$base/include/python$py_version_short$abiflags/$dist_name', 'scripts': '$base/bin', 'data' : '$base', }, 'unix_home': { 'purelib': '$base/lib/python', - 'platlib': '$base/lib/python', + 'platlib': '$base/$platlibdir/python', 'headers': '$base/include/python/$dist_name', 'scripts': '$base/bin', 'data' : '$base', @@ -298,6 +298,7 @@ class install(Command): 'sys_exec_prefix': exec_prefix, 'exec_prefix': exec_prefix, 'abiflags': abiflags, + 'platlibdir': sys.platlibdir, } if HAS_USER_SITE: diff --git a/sysconfig.py b/sysconfig.py index b51629eb..01ee5197 100644 --- a/sysconfig.py +++ b/sysconfig.py @@ -146,8 +146,15 @@ def get_python_lib(plat_specific=0, standard_lib=0, prefix=None): prefix = plat_specific and EXEC_PREFIX or PREFIX if os.name == "posix": - libpython = os.path.join(prefix, - "lib", "python" + get_python_version()) + if plat_specific or standard_lib: + # Platform-specific modules (any module from a non-pure-Python + # module distribution) or standard Python library modules. + libdir = sys.platlibdir + else: + # Pure Python + libdir = "lib" + libpython = os.path.join(prefix, libdir, + "python" + get_python_version()) if standard_lib: return libpython else: diff --git a/tests/test_install.py b/tests/test_install.py index 287ab198..51c80e04 100644 --- a/tests/test_install.py +++ b/tests/test_install.py @@ -58,7 +58,8 @@ class InstallTestCase(support.TempdirManager, libdir = os.path.join(destination, "lib", "python") check_path(cmd.install_lib, libdir) - check_path(cmd.install_platlib, libdir) + platlibdir = os.path.join(destination, sys.platlibdir, "python") + check_path(cmd.install_platlib, platlibdir) check_path(cmd.install_purelib, libdir) check_path(cmd.install_headers, os.path.join(destination, "include", "python", "foopkg")) |
