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>
This commit is contained in:
Victor Stinner 2020-03-10 09:53:09 +01:00 committed by GitHub
parent 700cb58730
commit 8510f43078
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 210 additions and 54 deletions

View file

@ -2739,8 +2739,6 @@ err_occurred:
return _PyStatus_ERR("can't initialize sys module");
}
#undef SET_SYS_FROM_STRING
/* Updating the sys namespace, returning integer error codes */
#define SET_SYS_FROM_STRING_INT_RESULT(key, value) \
do { \
@ -2844,6 +2842,13 @@ _PySys_InitMain(PyThreadState *tstate)
SET_SYS_FROM_WSTR("base_prefix", config->base_prefix);
SET_SYS_FROM_WSTR("exec_prefix", config->exec_prefix);
SET_SYS_FROM_WSTR("base_exec_prefix", config->base_exec_prefix);
{
PyObject *str = PyUnicode_FromString(PLATLIBDIR);
if (str == NULL) {
return -1;
}
SET_SYS_FROM_STRING("platlibdir", str);
}
if (config->pycache_prefix != NULL) {
SET_SYS_FROM_WSTR("pycache_prefix", config->pycache_prefix);
@ -2864,6 +2869,7 @@ _PySys_InitMain(PyThreadState *tstate)
#undef COPY_LIST
#undef SET_SYS_FROM_WSTR
/* Set flags to their final values */
SET_SYS_FROM_STRING_INT_RESULT("flags", make_flags(tstate));
/* prevent user from creating new instances */
@ -2897,6 +2903,7 @@ err_occurred:
return -1;
}
#undef SET_SYS_FROM_STRING
#undef SET_SYS_FROM_STRING_BORROW
#undef SET_SYS_FROM_STRING_INT_RESULT