mirror of
https://git.yoctoproject.org/git/poky
synced 2026-01-01 13:58:04 +00:00
I took the same approach as the recent perl upgrade: write recipe from scratch, taking the pieces from the old recipe only when they were proven to be necessary. The pgo, manifest and ptest features are all preserved. New features: - native and target recipes are now unified into one recipe - check_build_completeness.py runs right after do_compile() and verifies that all optional modules have been built (a notorious source of regressions) - a new approach to sysconfig.py and distutils/sysconfig.py returning values appropriate for native or target builds: we copy the configuration file to a separate folder, add that folder to sys.path (through environment variable that differs between native and target builds), and point python to the file through another environment variable. There were a few other patches where it was difficult to decide if the patch is still relevant, and how to test that it works correctly; please add those as-needed by testing the new python. (From OE-Core rev: 02714c105426b0d687620913c1a7401b386428b6) Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
197 lines
7.1 KiB
Diff
197 lines
7.1 KiB
Diff
From 0fbdad1eaf541a8e92be81f39514cd249b3b0801 Mon Sep 17 00:00:00 2001
|
|
From: Alexander Kanavin <alex.kanavin@gmail.com>
|
|
Date: Tue, 5 Feb 2019 15:52:02 +0100
|
|
Subject: [PATCH] Do not hardcode "lib" as location for modules, site-packages
|
|
and lib-dynload
|
|
|
|
Upstream-Status: Inappropriate [oe-core specific]
|
|
Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
|
|
|
|
---
|
|
Include/pythonrun.h | 2 ++
|
|
Lib/site.py | 4 ++--
|
|
Makefile.pre.in | 5 +++--
|
|
Modules/getpath.c | 18 ++++++++++++------
|
|
Python/getplatform.c | 10 ++++++++++
|
|
Python/sysmodule.c | 2 ++
|
|
6 files changed, 31 insertions(+), 10 deletions(-)
|
|
|
|
diff --git a/Include/pythonrun.h b/Include/pythonrun.h
|
|
index 6f0c6fc..0a17edd 100644
|
|
--- a/Include/pythonrun.h
|
|
+++ b/Include/pythonrun.h
|
|
@@ -7,6 +7,8 @@
|
|
extern "C" {
|
|
#endif
|
|
|
|
+PyAPI_FUNC(const char *) Py_GetLib(void);
|
|
+
|
|
#ifndef Py_LIMITED_API
|
|
PyAPI_FUNC(int) PyRun_SimpleStringFlags(const char *, PyCompilerFlags *);
|
|
PyAPI_FUNC(int) PyRun_AnyFileFlags(FILE *, const char *, PyCompilerFlags *);
|
|
diff --git a/Lib/site.py b/Lib/site.py
|
|
index ffd132b..b55f6d8 100644
|
|
--- a/Lib/site.py
|
|
+++ b/Lib/site.py
|
|
@@ -334,12 +334,12 @@ def getsitepackages(prefixes=None):
|
|
seen.add(prefix)
|
|
|
|
if os.sep == '/':
|
|
- sitepackages.append(os.path.join(prefix, "lib",
|
|
+ sitepackages.append(os.path.join(prefix, sys.lib,
|
|
"python%d.%d" % sys.version_info[:2],
|
|
"site-packages"))
|
|
else:
|
|
sitepackages.append(prefix)
|
|
- sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
|
|
+ sitepackages.append(os.path.join(prefix, sys.lib, "site-packages"))
|
|
return sitepackages
|
|
|
|
def addsitepackages(known_paths, prefixes=None):
|
|
diff --git a/Makefile.pre.in b/Makefile.pre.in
|
|
index 6e81b2f..671a20e 100644
|
|
--- a/Makefile.pre.in
|
|
+++ b/Makefile.pre.in
|
|
@@ -142,7 +142,7 @@ LIBDIR= @libdir@
|
|
MANDIR= @mandir@
|
|
INCLUDEDIR= @includedir@
|
|
CONFINCLUDEDIR= $(exec_prefix)/include
|
|
-SCRIPTDIR= $(prefix)/lib
|
|
+SCRIPTDIR= @libdir@
|
|
ABIFLAGS= @ABIFLAGS@
|
|
|
|
# Detailed destination directories
|
|
@@ -768,6 +768,7 @@ Modules/getpath.o: $(srcdir)/Modules/getpath.c Makefile
|
|
-DEXEC_PREFIX='"$(exec_prefix)"' \
|
|
-DVERSION='"$(VERSION)"' \
|
|
-DVPATH='"$(VPATH)"' \
|
|
+ -DLIB='"$(LIB)"' \
|
|
-o $@ $(srcdir)/Modules/getpath.c
|
|
|
|
Programs/python.o: $(srcdir)/Programs/python.c
|
|
@@ -856,7 +857,7 @@ regen-opcode:
|
|
Python/compile.o Python/symtable.o Python/ast_unparse.o Python/ast.o: $(srcdir)/Include/graminit.h $(srcdir)/Include/Python-ast.h
|
|
|
|
Python/getplatform.o: $(srcdir)/Python/getplatform.c
|
|
- $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -o $@ $(srcdir)/Python/getplatform.c
|
|
+ $(CC) -c $(PY_CORE_CFLAGS) -DPLATFORM='"$(MACHDEP)"' -DLIB='"$(LIB)"' -o $@ $(srcdir)/Python/getplatform.c
|
|
|
|
Python/importdl.o: $(srcdir)/Python/importdl.c
|
|
$(CC) -c $(PY_CORE_CFLAGS) -I$(DLINCLDIR) -o $@ $(srcdir)/Python/importdl.c
|
|
diff --git a/Modules/getpath.c b/Modules/getpath.c
|
|
index e6a3e8e..0c62af6 100644
|
|
--- a/Modules/getpath.c
|
|
+++ b/Modules/getpath.c
|
|
@@ -123,6 +123,7 @@ typedef struct {
|
|
wchar_t *exec_prefix; /* EXEC_PREFIX define */
|
|
|
|
wchar_t *lib_python; /* "lib/pythonX.Y" */
|
|
+ wchar_t *multilib_python; /* "lib[suffix]/pythonX.Y" */
|
|
wchar_t argv0_path[MAXPATHLEN+1];
|
|
wchar_t zip_path[MAXPATHLEN+1]; /* ".../lib/pythonXY.zip" */
|
|
|
|
@@ -314,7 +315,7 @@ search_for_prefix(const _PyCoreConfig *core_config,
|
|
if (delim) {
|
|
*delim = L'\0';
|
|
}
|
|
- joinpath(prefix, calculate->lib_python);
|
|
+ joinpath(prefix, calculate->multilib_python);
|
|
joinpath(prefix, LANDMARK);
|
|
return 1;
|
|
}
|
|
@@ -343,7 +344,7 @@ search_for_prefix(const _PyCoreConfig *core_config,
|
|
copy_absolute(prefix, calculate->argv0_path, MAXPATHLEN+1);
|
|
do {
|
|
n = wcslen(prefix);
|
|
- joinpath(prefix, calculate->lib_python);
|
|
+ joinpath(prefix, calculate->multilib_python);
|
|
joinpath(prefix, LANDMARK);
|
|
if (ismodule(prefix)) {
|
|
return 1;
|
|
@@ -355,7 +356,7 @@ search_for_prefix(const _PyCoreConfig *core_config,
|
|
/* Look at configure's PREFIX */
|
|
wcsncpy(prefix, calculate->prefix, MAXPATHLEN);
|
|
prefix[MAXPATHLEN] = L'\0';
|
|
- joinpath(prefix, calculate->lib_python);
|
|
+ joinpath(prefix, calculate->multilib_python);
|
|
joinpath(prefix, LANDMARK);
|
|
if (ismodule(prefix)) {
|
|
return 1;
|
|
@@ -427,7 +428,7 @@ search_for_exec_prefix(const _PyCoreConfig *core_config,
|
|
wcsncpy(exec_prefix, core_config->home, MAXPATHLEN);
|
|
}
|
|
exec_prefix[MAXPATHLEN] = L'\0';
|
|
- joinpath(exec_prefix, calculate->lib_python);
|
|
+ joinpath(exec_prefix, calculate->multilib_python);
|
|
joinpath(exec_prefix, L"lib-dynload");
|
|
return 1;
|
|
}
|
|
@@ -464,7 +465,7 @@ search_for_exec_prefix(const _PyCoreConfig *core_config,
|
|
copy_absolute(exec_prefix, calculate->argv0_path, MAXPATHLEN+1);
|
|
do {
|
|
n = wcslen(exec_prefix);
|
|
- joinpath(exec_prefix, calculate->lib_python);
|
|
+ joinpath(exec_prefix, calculate->multilib_python);
|
|
joinpath(exec_prefix, L"lib-dynload");
|
|
if (isdir(exec_prefix)) {
|
|
return 1;
|
|
@@ -476,7 +477,7 @@ search_for_exec_prefix(const _PyCoreConfig *core_config,
|
|
/* Look at configure's EXEC_PREFIX */
|
|
wcsncpy(exec_prefix, calculate->exec_prefix, MAXPATHLEN);
|
|
exec_prefix[MAXPATHLEN] = L'\0';
|
|
- joinpath(exec_prefix, calculate->lib_python);
|
|
+ joinpath(exec_prefix, calculate->multilib_python);
|
|
joinpath(exec_prefix, L"lib-dynload");
|
|
if (isdir(exec_prefix)) {
|
|
return 1;
|
|
@@ -871,6 +872,10 @@ calculate_init(PyCalculatePath *calculate,
|
|
if (!calculate->lib_python) {
|
|
return DECODE_LOCALE_ERR("EXEC_PREFIX define", len);
|
|
}
|
|
+ calculate->multilib_python = Py_DecodeLocale(LIB "/python" VERSION, &len);
|
|
+ if (!calculate->multilib_python) {
|
|
+ return DECODE_LOCALE_ERR("EXEC_PREFIX define", len);
|
|
+ }
|
|
return _Py_INIT_OK();
|
|
}
|
|
|
|
@@ -882,6 +887,7 @@ calculate_free(PyCalculatePath *calculate)
|
|
PyMem_RawFree(calculate->prefix);
|
|
PyMem_RawFree(calculate->exec_prefix);
|
|
PyMem_RawFree(calculate->lib_python);
|
|
+ PyMem_RawFree(calculate->multilib_python);
|
|
PyMem_RawFree(calculate->path_env);
|
|
}
|
|
|
|
diff --git a/Python/getplatform.c b/Python/getplatform.c
|
|
index 81a0f7a..d55396b 100644
|
|
--- a/Python/getplatform.c
|
|
+++ b/Python/getplatform.c
|
|
@@ -10,3 +10,13 @@ Py_GetPlatform(void)
|
|
{
|
|
return PLATFORM;
|
|
}
|
|
+
|
|
+#ifndef LIB
|
|
+#define LIB "lib"
|
|
+#endif
|
|
+
|
|
+const char *
|
|
+Py_GetLib(void)
|
|
+{
|
|
+ return LIB;
|
|
+}
|
|
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
|
|
index efe5b29..de77b17 100644
|
|
--- a/Python/sysmodule.c
|
|
+++ b/Python/sysmodule.c
|
|
@@ -2319,6 +2319,8 @@ _PySys_BeginInit(PyObject **sysmod)
|
|
PyUnicode_FromString(Py_GetCopyright()));
|
|
SET_SYS_FROM_STRING("platform",
|
|
PyUnicode_FromString(Py_GetPlatform()));
|
|
+ SET_SYS_FROM_STRING("lib",
|
|
+ PyUnicode_FromString(Py_GetLib()));
|
|
SET_SYS_FROM_STRING("maxsize",
|
|
PyLong_FromSsize_t(PY_SSIZE_T_MAX));
|
|
SET_SYS_FROM_STRING("float_info",
|