SHA256
1
0
forked from pool/python38

Accepting request 1030164 from home:dgarcia:branches:devel:languages:python:Factory

- Add platlibdir-in-sys.patch to provide sys.platlibdir attribute. This is used
  by python-setuptools in distutils.sysconfig.get_python_lib bsc#1204395

OBS-URL: https://build.opensuse.org/request/show/1030164
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:Factory/python38?expand=0&rev=107
This commit is contained in:
Matej Cepl 2022-10-20 18:12:06 +00:00 committed by Git OBS Bridge
parent b21d8c938d
commit 75d8efff80
3 changed files with 135 additions and 0 deletions

126
platlibdir-in-sys.patch Normal file
View File

@ -0,0 +1,126 @@
Index: Python-3.8.15/Python/sysmodule.c
===================================================================
--- Python-3.8.15.orig/Python/sysmodule.c
+++ Python-3.8.15/Python/sysmodule.c
@@ -2979,6 +2979,7 @@ _PySys_InitMain(_PyRuntimeState *runtime
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);
+ SET_SYS_FROM_WSTR("platlibdir", config->platlibdir);
if (config->pycache_prefix != NULL) {
SET_SYS_FROM_WSTR("pycache_prefix", config->pycache_prefix);
Index: Python-3.8.15/Include/cpython/initconfig.h
===================================================================
--- Python-3.8.15.orig/Include/cpython/initconfig.h
+++ Python-3.8.15/Include/cpython/initconfig.h
@@ -381,6 +381,7 @@ typedef struct {
wchar_t *base_prefix; /* sys.base_prefix */
wchar_t *exec_prefix; /* sys.exec_prefix */
wchar_t *base_exec_prefix; /* sys.base_exec_prefix */
+ wchar_t *platlibdir; /* sys.platlibdir */
/* --- Parameter only used by Py_Main() ---------- */
Index: Python-3.8.15/Python/initconfig.c
===================================================================
--- Python-3.8.15.orig/Python/initconfig.c
+++ Python-3.8.15/Python/initconfig.c
@@ -596,6 +596,7 @@ PyConfig_Clear(PyConfig *config)
CLEAR(config->base_prefix);
CLEAR(config->exec_prefix);
CLEAR(config->base_exec_prefix);
+ CLEAR(config->platlibdir);
CLEAR(config->filesystem_encoding);
CLEAR(config->filesystem_errors);
@@ -834,6 +835,7 @@ _PyConfig_Copy(PyConfig *config, const P
COPY_WSTR_ATTR(base_prefix);
COPY_WSTR_ATTR(exec_prefix);
COPY_WSTR_ATTR(base_exec_prefix);
+ COPY_WSTR_ATTR(platlibdir);
COPY_ATTR(site_import);
COPY_ATTR(bytes_warning);
@@ -935,6 +937,7 @@ config_as_dict(const PyConfig *config)
SET_ITEM_WSTR(base_prefix);
SET_ITEM_WSTR(exec_prefix);
SET_ITEM_WSTR(base_exec_prefix);
+ SET_ITEM_WSTR(platlibdir);
SET_ITEM_INT(site_import);
SET_ITEM_INT(bytes_warning);
SET_ITEM_INT(inspect);
@@ -1336,6 +1339,14 @@ config_read_env_vars(PyConfig *config)
config->malloc_stats = 1;
}
+ if(config->platlibdir == NULL) {
+ status = CONFIG_GET_ENV_DUP(config, &config->platlibdir,
+ L"PYTHONPLATLIBDIR", "PYTHONPLATLIBDIR");
+ if (_PyStatus_EXCEPTION(status)) {
+ return status;
+ }
+ }
+
if (config->pythonpath_env == NULL) {
status = CONFIG_GET_ENV_DUP(config, &config->pythonpath_env,
L"PYTHONPATH", "PYTHONPATH");
@@ -1786,6 +1797,14 @@ config_read(PyConfig *config)
}
}
+ if(config->platlibdir == NULL) {
+ status = CONFIG_SET_BYTES_STR(config, &config->platlibdir, PLATLIBDIR,
+ "PLATLIBDIR macro");
+ if (_PyStatus_EXCEPTION(status)) {
+ return status;
+ }
+ }
+
if (config->_install_importlib) {
status = _PyConfig_InitPathConfig(config);
if (_PyStatus_EXCEPTION(status)) {
@@ -2565,6 +2584,7 @@ PyConfig_Read(PyConfig *config)
assert(config->exec_prefix != NULL);
assert(config->base_exec_prefix != NULL);
}
+ assert(config->platlibdir != NULL);
assert(config->filesystem_encoding != NULL);
assert(config->filesystem_errors != NULL);
assert(config->stdio_encoding != NULL);
@@ -2715,6 +2735,7 @@ _Py_DumpPathConfig(PyThreadState *tstate
DUMP_SYS(_base_executable);
DUMP_SYS(base_prefix);
DUMP_SYS(base_exec_prefix);
+ DUMP_SYS(platlibdir);
DUMP_SYS(executable);
DUMP_SYS(prefix);
DUMP_SYS(exec_prefix);
Index: Python-3.8.15/Makefile.pre.in
===================================================================
--- Python-3.8.15.orig/Makefile.pre.in
+++ Python-3.8.15/Makefile.pre.in
@@ -811,6 +811,11 @@ Python/sysmodule.o: $(srcdir)/Python/sys
$(MULTIARCH_CPPFLAGS) \
-o $@ $(srcdir)/Python/sysmodule.c
+Python/initconfig.o: $(srcdir)/Python/initconfig.c
+ $(CC) -c $(PY_CORE_CFLAGS) \
+ -DPLATLIBDIR='"$(platsubdir)"' \
+ -o $@ $(srcdir)/Python/initconfig.c
+
$(IO_OBJS): $(IO_H)
.PHONY: regen-grammar
Index: Python-3.8.15/Lib/test/test_embed.py
===================================================================
--- Python-3.8.15.orig/Lib/test/test_embed.py
+++ Python-3.8.15/Lib/test/test_embed.py
@@ -382,6 +382,7 @@ class InitConfigTests(EmbeddingTestsMixi
'exec_prefix': GET_DEFAULT_CONFIG,
'base_exec_prefix': GET_DEFAULT_CONFIG,
'module_search_paths': GET_DEFAULT_CONFIG,
+ 'platlibdir': sys.platlibdir,
'site_import': 1,
'bytes_warning': 0,

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Thu Oct 20 11:49:44 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
- Add platlibdir-in-sys.patch to provide sys.platlibdir attribute. This is used
by python-setuptools in distutils.sysconfig.get_python_lib bsc#1204395
-------------------------------------------------------------------
Wed Oct 19 07:12:23 UTC 2022 - Matej Cepl <mcepl@suse.com>

View File

@ -171,6 +171,8 @@ Patch34: bpo34990-2038-problem-compileall.patch
# PATCH-FIX-UPSTREAM gh#python/cpython#90967 gh#python/cpython#93900 mcepl@suse.com
# NOTE: SUSE version of expat 2.4.4 is patched in SUSE for CVE-2022-25236
Patch36: support-expat-CVE-2022-25236-patched.patch
# PATCH-FIX-OPENSUSE platlibdir-in-sys.patch bsc#1204395
Patch37: platlibdir-in-sys.patch
BuildRequires: autoconf-archive
BuildRequires: automake
BuildRequires: fdupes
@ -437,6 +439,7 @@ other applications.
%patch33 -p1
%patch34 -p1
%patch36 -p1
%patch37 -p1
# drop Autoconf version requirement
sed -i 's/^AC_PREREQ/dnl AC_PREREQ/' configure.ac