diff options
Diffstat (limited to 'meta/recipes-devtools/python/python3/0001-Do-not-hardcode-lib-as-location-for-site-packages-an.patch')
-rw-r--r-- | meta/recipes-devtools/python/python3/0001-Do-not-hardcode-lib-as-location-for-site-packages-an.patch | 156 |
1 files changed, 87 insertions, 69 deletions
diff --git a/meta/recipes-devtools/python/python3/0001-Do-not-hardcode-lib-as-location-for-site-packages-an.patch b/meta/recipes-devtools/python/python3/0001-Do-not-hardcode-lib-as-location-for-site-packages-an.patch index ea75262c4f..112c979441 100644 --- a/meta/recipes-devtools/python/python3/0001-Do-not-hardcode-lib-as-location-for-site-packages-an.patch +++ b/meta/recipes-devtools/python/python3/0001-Do-not-hardcode-lib-as-location-for-site-packages-an.patch | |||
@@ -1,4 +1,4 @@ | |||
1 | From 0fbdad1eaf541a8e92be81f39514cd249b3b0801 Mon Sep 17 00:00:00 2001 | 1 | From a078b6ff1492e848ad1055764fb9a414abaf3e12 Mon Sep 17 00:00:00 2001 |
2 | From: Alexander Kanavin <alex.kanavin@gmail.com> | 2 | From: Alexander Kanavin <alex.kanavin@gmail.com> |
3 | Date: Tue, 5 Feb 2019 15:52:02 +0100 | 3 | Date: Tue, 5 Feb 2019 15:52:02 +0100 |
4 | Subject: [PATCH] Do not hardcode "lib" as location for modules, site-packages | 4 | Subject: [PATCH] Do not hardcode "lib" as location for modules, site-packages |
@@ -11,13 +11,13 @@ Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | |||
11 | Include/pythonrun.h | 2 ++ | 11 | Include/pythonrun.h | 2 ++ |
12 | Lib/site.py | 4 ++-- | 12 | Lib/site.py | 4 ++-- |
13 | Makefile.pre.in | 5 +++-- | 13 | Makefile.pre.in | 5 +++-- |
14 | Modules/getpath.c | 18 ++++++++++++------ | 14 | Modules/getpath.c | 22 ++++++++++++++-------- |
15 | Python/getplatform.c | 10 ++++++++++ | 15 | Python/getplatform.c | 10 ++++++++++ |
16 | Python/sysmodule.c | 2 ++ | 16 | Python/sysmodule.c | 2 ++ |
17 | 6 files changed, 31 insertions(+), 10 deletions(-) | 17 | 6 files changed, 33 insertions(+), 12 deletions(-) |
18 | 18 | ||
19 | diff --git a/Include/pythonrun.h b/Include/pythonrun.h | 19 | diff --git a/Include/pythonrun.h b/Include/pythonrun.h |
20 | index 6f0c6fc..0a17edd 100644 | 20 | index 46091e0..61b2e15 100644 |
21 | --- a/Include/pythonrun.h | 21 | --- a/Include/pythonrun.h |
22 | +++ b/Include/pythonrun.h | 22 | +++ b/Include/pythonrun.h |
23 | @@ -7,6 +7,8 @@ | 23 | @@ -7,6 +7,8 @@ |
@@ -28,12 +28,12 @@ index 6f0c6fc..0a17edd 100644 | |||
28 | + | 28 | + |
29 | #ifndef Py_LIMITED_API | 29 | #ifndef Py_LIMITED_API |
30 | PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *); | 30 | PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *); |
31 | PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *); | 31 | PyAPI_FUNC(int) PyRun_AnyFileExFlags( |
32 | diff --git a/Lib/site.py b/Lib/site.py | 32 | diff --git a/Lib/site.py b/Lib/site.py |
33 | index ffd132b..b55f6d8 100644 | 33 | index a065ab0..1d720ef 100644 |
34 | --- a/Lib/site.py | 34 | --- a/Lib/site.py |
35 | +++ b/Lib/site.py | 35 | +++ b/Lib/site.py |
36 | @@ -334,12 +334,12 @@ def getsitepackages(prefixes=None): | 36 | @@ -335,12 +335,12 @@ def getsitepackages(prefixes=None): |
37 | seen.add(prefix) | 37 | seen.add(prefix) |
38 | 38 | ||
39 | if os.sep == '/': | 39 | if os.sep == '/': |
@@ -49,10 +49,10 @@ index ffd132b..b55f6d8 100644 | |||
49 | 49 | ||
50 | def addsitepackages(known_paths, prefixes=None): | 50 | def addsitepackages(known_paths, prefixes=None): |
51 | diff --git a/Makefile.pre.in b/Makefile.pre.in | 51 | diff --git a/Makefile.pre.in b/Makefile.pre.in |
52 | index 6e81b2f..671a20e 100644 | 52 | index 65665df..be49140 100644 |
53 | --- a/Makefile.pre.in | 53 | --- a/Makefile.pre.in |
54 | +++ b/Makefile.pre.in | 54 | +++ b/Makefile.pre.in |
55 | @@ -142,7 +142,7 @@ LIBDIR= @libdir@ | 55 | @@ -143,7 +143,7 @@ LIBDIR= @libdir@ |
56 | MANDIR= @mandir@ | 56 | MANDIR= @mandir@ |
57 | INCLUDEDIR= @includedir@ | 57 | INCLUDEDIR= @includedir@ |
58 | CONFINCLUDEDIR= $(exec_prefix)/include | 58 | CONFINCLUDEDIR= $(exec_prefix)/include |
@@ -61,7 +61,7 @@ index 6e81b2f..671a20e 100644 | |||
61 | ABIFLAGS= @ABIFLAGS@ | 61 | ABIFLAGS= @ABIFLAGS@ |
62 | 62 | ||
63 | # Detailed destination directories | 63 | # Detailed destination directories |
64 | @@ -768,6 +768,7 @@ Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile | 64 | @@ -753,6 +753,7 @@ Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile |
65 | -DEXEC_PREFIX='"$(exec_prefix)"' \ | 65 | -DEXEC_PREFIX='"$(exec_prefix)"' \ |
66 | -DVERSION='"$(VERSION)"' \ | 66 | -DVERSION='"$(VERSION)"' \ |
67 | -DVPATH='"$(VPATH)"' \ | 67 | -DVPATH='"$(VPATH)"' \ |
@@ -69,7 +69,7 @@ index 6e81b2f..671a20e 100644 | |||
69 | -o $@ $(srcdir)/Modules/getpath.c | 69 | -o $@ $(srcdir)/Modules/getpath.c |
70 | 70 | ||
71 | Programs/python.o: $(srcdir)/Programs/python.c | 71 | Programs/python.o: $(srcdir)/Programs/python.c |
72 | @@ -856,7 +857,7 @@ regen-opcode: | 72 | @@ -868,7 +869,7 @@ regen-symbol: $(srcdir)/Include/graminit.h |
73 | Python/compile.o Python/symtable.o Python/ast_unparse.o Python/ast.o Python/future.o Parser/parsetok.o: $(srcdir)/Include/graminit.h $(srcdir)/Include/Python-ast.h | 73 | Python/compile.o Python/symtable.o Python/ast_unparse.o Python/ast.o Python/future.o Parser/parsetok.o: $(srcdir)/Include/graminit.h $(srcdir)/Include/Python-ast.h |
74 | 74 | ||
75 | Python/getplatform.o: $(srcdir)/Python/getplatform.c | 75 | Python/getplatform.o: $(srcdir)/Python/getplatform.c |
@@ -79,72 +79,90 @@ index 6e81b2f..671a20e 100644 | |||
79 | Python/importdl.o: $(srcdir)/Python/importdl.c | 79 | Python/importdl.o: $(srcdir)/Python/importdl.c |
80 | $(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c | 80 | $(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c |
81 | diff --git a/Modules/getpath.c b/Modules/getpath.c | 81 | diff --git a/Modules/getpath.c b/Modules/getpath.c |
82 | index e6a3e8e..0c62af6 100644 | 82 | index b727f66..c003e46 100644 |
83 | --- a/Modules/getpath.c | 83 | --- a/Modules/getpath.c |
84 | +++ b/Modules/getpath.c | 84 | +++ b/Modules/getpath.c |
85 | @@ -123,6 +123,7 @@ typedef struct { | 85 | @@ -128,6 +128,7 @@ typedef struct { |
86 | wchar_t *exec_prefix; /* EXEC_PREFIX define */ | 86 | wchar_t *exec_prefix; /* EXEC_PREFIX macro */ |
87 | 87 | ||
88 | wchar_t *lib_python; /* "lib/pythonX.Y" */ | 88 | wchar_t *lib_python; /* "lib/pythonX.Y" */ |
89 | + wchar_t *multilib_python; /* "lib[suffix]/pythonX.Y" */ | 89 | + wchar_t *multilib_python; /* "lib[suffix]/pythonX.Y" */ |
90 | wchar_t argv0_path[MAXPATHLEN+1]; | ||
91 | wchar_t zip_path[MAXPATHLEN+1]; /* ".../lib/pythonXY.zip" */ | ||
92 | 90 | ||
93 | @@ -314,7 +315,7 @@ search_for_prefix(const _PyCoreConfig *core_config, | 91 | int prefix_found; /* found platform independent libraries? */ |
92 | int exec_prefix_found; /* found the platform dependent libraries? */ | ||
93 | @@ -386,7 +387,7 @@ search_for_prefix(PyCalculatePath *calculate, _PyPathConfig *pathconfig, | ||
94 | if (delim) { | 94 | if (delim) { |
95 | *delim = L'\0'; | 95 | *delim = L'\0'; |
96 | } | 96 | } |
97 | - joinpath(prefix, calculate->lib_python); | 97 | - status = joinpath(prefix, calculate->lib_python, prefix_len); |
98 | + joinpath(prefix, calculate->multilib_python); | 98 | + status = joinpath(prefix, calculate->multilib_python, prefix_len); |
99 | joinpath(prefix, LANDMARK); | 99 | if (_PyStatus_EXCEPTION(status)) { |
100 | return 1; | 100 | return status; |
101 | } | 101 | } |
102 | @@ -343,7 +344,7 @@ search_for_prefix(const _PyCoreConfig *core_config, | 102 | @@ -444,7 +445,7 @@ search_for_prefix(PyCalculatePath *calculate, _PyPathConfig *pathconfig, |
103 | copy_absolute(prefix, calculate->argv0_path, MAXPATHLEN+1); | ||
104 | do { | 103 | do { |
105 | n = wcslen(prefix); | 104 | /* Path: <argv0_path or substring> / <lib_python> / LANDMARK */ |
106 | - joinpath(prefix, calculate->lib_python); | 105 | size_t n = wcslen(prefix); |
107 | + joinpath(prefix, calculate->multilib_python); | 106 | - status = joinpath(prefix, calculate->lib_python, prefix_len); |
108 | joinpath(prefix, LANDMARK); | 107 | + status = joinpath(prefix, calculate->multilib_python, prefix_len); |
109 | if (ismodule(prefix)) { | 108 | if (_PyStatus_EXCEPTION(status)) { |
110 | return 1; | 109 | return status; |
111 | @@ -355,7 +356,7 @@ search_for_prefix(const _PyCoreConfig *core_config, | ||
112 | /* Look at configure's PREFIX */ | ||
113 | wcsncpy(prefix, calculate->prefix, MAXPATHLEN); | ||
114 | prefix[MAXPATHLEN] = L'\0'; | ||
115 | - joinpath(prefix, calculate->lib_python); | ||
116 | + joinpath(prefix, calculate->multilib_python); | ||
117 | joinpath(prefix, LANDMARK); | ||
118 | if (ismodule(prefix)) { | ||
119 | return 1; | ||
120 | @@ -427,7 +428,7 @@ search_for_exec_prefix(const _PyCoreConfig *core_config, | ||
121 | wcsncpy(exec_prefix, core_config->home, MAXPATHLEN); | ||
122 | } | 110 | } |
123 | exec_prefix[MAXPATHLEN] = L'\0'; | 111 | @@ -467,7 +468,7 @@ search_for_prefix(PyCalculatePath *calculate, _PyPathConfig *pathconfig, |
124 | - joinpath(exec_prefix, calculate->lib_python); | 112 | if (safe_wcscpy(prefix, calculate->prefix, prefix_len) < 0) { |
125 | + joinpath(exec_prefix, calculate->multilib_python); | 113 | return PATHLEN_ERR(); |
126 | joinpath(exec_prefix, L"lib-dynload"); | 114 | } |
127 | return 1; | 115 | - status = joinpath(prefix, calculate->lib_python, prefix_len); |
116 | + status = joinpath(prefix, calculate->multilib_python, prefix_len); | ||
117 | if (_PyStatus_EXCEPTION(status)) { | ||
118 | return status; | ||
128 | } | 119 | } |
129 | @@ -464,7 +465,7 @@ search_for_exec_prefix(const _PyCoreConfig *core_config, | 120 | @@ -510,7 +511,7 @@ calculate_prefix(PyCalculatePath *calculate, _PyPathConfig *pathconfig, |
130 | copy_absolute(exec_prefix, calculate->argv0_path, MAXPATHLEN+1); | 121 | if (safe_wcscpy(prefix, calculate->prefix, prefix_len) < 0) { |
122 | return PATHLEN_ERR(); | ||
123 | } | ||
124 | - status = joinpath(prefix, calculate->lib_python, prefix_len); | ||
125 | + status = joinpath(prefix, calculate->multilib_python, prefix_len); | ||
126 | if (_PyStatus_EXCEPTION(status)) { | ||
127 | return status; | ||
128 | } | ||
129 | @@ -635,7 +636,7 @@ search_for_exec_prefix(PyCalculatePath *calculate, _PyPathConfig *pathconfig, | ||
130 | return PATHLEN_ERR(); | ||
131 | } | ||
132 | } | ||
133 | - status = joinpath(exec_prefix, calculate->lib_python, exec_prefix_len); | ||
134 | + status = joinpath(exec_prefix, calculate->multilib_python, exec_prefix_len); | ||
135 | if (_PyStatus_EXCEPTION(status)) { | ||
136 | return status; | ||
137 | } | ||
138 | @@ -667,7 +668,7 @@ search_for_exec_prefix(PyCalculatePath *calculate, _PyPathConfig *pathconfig, | ||
131 | do { | 139 | do { |
132 | n = wcslen(exec_prefix); | 140 | /* Path: <argv0_path or substring> / <lib_python> / "lib-dynload" */ |
133 | - joinpath(exec_prefix, calculate->lib_python); | 141 | size_t n = wcslen(exec_prefix); |
134 | + joinpath(exec_prefix, calculate->multilib_python); | 142 | - status = joinpath(exec_prefix, calculate->lib_python, exec_prefix_len); |
135 | joinpath(exec_prefix, L"lib-dynload"); | 143 | + status = joinpath(exec_prefix, calculate->multilib_python, exec_prefix_len); |
136 | if (isdir(exec_prefix)) { | 144 | if (_PyStatus_EXCEPTION(status)) { |
137 | return 1; | 145 | return status; |
138 | @@ -476,7 +477,7 @@ search_for_exec_prefix(const _PyCoreConfig *core_config, | 146 | } |
139 | /* Look at configure's EXEC_PREFIX */ | 147 | @@ -689,7 +690,7 @@ search_for_exec_prefix(PyCalculatePath *calculate, _PyPathConfig *pathconfig, |
140 | wcsncpy(exec_prefix, calculate->exec_prefix, MAXPATHLEN); | 148 | if (safe_wcscpy(exec_prefix, calculate->exec_prefix, exec_prefix_len) < 0) { |
141 | exec_prefix[MAXPATHLEN] = L'\0'; | 149 | return PATHLEN_ERR(); |
142 | - joinpath(exec_prefix, calculate->lib_python); | 150 | } |
143 | + joinpath(exec_prefix, calculate->multilib_python); | 151 | - status = joinpath(exec_prefix, calculate->lib_python, exec_prefix_len); |
144 | joinpath(exec_prefix, L"lib-dynload"); | 152 | + status = joinpath(exec_prefix, calculate->multilib_python, exec_prefix_len); |
145 | if (isdir(exec_prefix)) { | 153 | if (_PyStatus_EXCEPTION(status)) { |
146 | return 1; | 154 | return status; |
147 | @@ -871,6 +872,10 @@ calculate_init(PyCalculatePath *calculate, | 155 | } |
156 | @@ -928,7 +929,7 @@ calculate_argv0_path(PyCalculatePath *calculate, const wchar_t *program_full_pat | ||
157 | return PATHLEN_ERR(); | ||
158 | } | ||
159 | reduce(argv0_path); | ||
160 | - status = joinpath(argv0_path, calculate->lib_python, argv0_path_len); | ||
161 | + status = joinpath(argv0_path, calculate->multilib_python, argv0_path_len); | ||
162 | if (_PyStatus_EXCEPTION(status)) { | ||
163 | PyMem_RawFree(wbuf); | ||
164 | return status; | ||
165 | @@ -1201,6 +1202,10 @@ calculate_init(PyCalculatePath *calculate, const PyConfig *config) | ||
148 | if (!calculate->lib_python) { | 166 | if (!calculate->lib_python) { |
149 | return DECODE_LOCALE_ERR("EXEC_PREFIX define", len); | 167 | return DECODE_LOCALE_ERR("EXEC_PREFIX define", len); |
150 | } | 168 | } |
@@ -152,10 +170,10 @@ index e6a3e8e..0c62af6 100644 | |||
152 | + if (!calculate->multilib_python) { | 170 | + if (!calculate->multilib_python) { |
153 | + return DECODE_LOCALE_ERR("EXEC_PREFIX define", len); | 171 | + return DECODE_LOCALE_ERR("EXEC_PREFIX define", len); |
154 | + } | 172 | + } |
155 | return _Py_INIT_OK(); | ||
156 | } | ||
157 | 173 | ||
158 | @@ -882,6 +887,7 @@ calculate_free(PyCalculatePath *calculate) | 174 | calculate->warnings = config->pathconfig_warnings; |
175 | calculate->pythonpath_env = config->pythonpath_env; | ||
176 | @@ -1216,6 +1221,7 @@ calculate_free(PyCalculatePath *calculate) | ||
159 | PyMem_RawFree(calculate->prefix); | 177 | PyMem_RawFree(calculate->prefix); |
160 | PyMem_RawFree(calculate->exec_prefix); | 178 | PyMem_RawFree(calculate->exec_prefix); |
161 | PyMem_RawFree(calculate->lib_python); | 179 | PyMem_RawFree(calculate->lib_python); |
@@ -182,10 +200,10 @@ index 81a0f7a..d55396b 100644 | |||
182 | + return LIB; | 200 | + return LIB; |
183 | +} | 201 | +} |
184 | diff --git a/Python/sysmodule.c b/Python/sysmodule.c | 202 | diff --git a/Python/sysmodule.c b/Python/sysmodule.c |
185 | index efe5b29..de77b17 100644 | 203 | index 5b0fb81..0dce754 100644 |
186 | --- a/Python/sysmodule.c | 204 | --- a/Python/sysmodule.c |
187 | +++ b/Python/sysmodule.c | 205 | +++ b/Python/sysmodule.c |
188 | @@ -2319,6 +2319,8 @@ _PySys_BeginInit(PyObject **sysmod) | 206 | @@ -2668,6 +2668,8 @@ _PySys_InitCore(_PyRuntimeState *runtime, PyInterpreterState *interp, |
189 | PyUnicode_FromString(Py_GetCopyright())); | 207 | PyUnicode_FromString(Py_GetCopyright())); |
190 | SET_SYS_FROM_STRING("platform", | 208 | SET_SYS_FROM_STRING("platform", |
191 | PyUnicode_FromString(Py_GetPlatform())); | 209 | PyUnicode_FromString(Py_GetPlatform())); |