summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaewon Lee <jaewon.lee@xilinx.com>2019-04-25 23:02:21 (GMT)
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-09-16 12:35:10 (GMT)
commite7e1b9a43dee9eb289e936513b2ee68963ae1628 (patch)
treeffe9ff7ff86c5ac335efdcf143c1e562df6fd7b3
parent904e05f4676fc4a6168feda73576e180596f451b (diff)
downloadpoky-e7e1b9a43dee9eb289e936513b2ee68963ae1628.tar.gz
Adding back wrapper and using OEPYTHON3HOME variable for python3
Adding back the python wrapper and adding a patch to use OEPYTHON3HOME instead of PYTHONHOME if set, for python3. If we add back the wrapper as is, we would see the following error that we also see in Thud: ImportError: No module named site OpenEmbedded requires 'python' to be python v2 (>= 2.7.3), not python v3. Please upgrade your python v2 This is because python3 would've set PYTHONHOME to use nativesdk python3 libraries but when the oe-buildenv-internal script tries to call python2 for the py_v27_check, there will be no python2 libraries in the PYTHONHOME directory. In other words, bitbake needs host python2 and the env variable set from the wrapper contaminates the env and host python2 won't be able to find its libraries Creating another variable OEPYTHON3HOME and using this in the python3 wrapper to allow for a way to set a different paths for python3 and python2 [YOCTO #13208] (From OE-Core rev: 75d2a85e24ef9a2bf0e218521944523f0ff281e0) (From OE-Core rev: b29e87376fdd49ce07749b87c3000033fa96e43f) Signed-off-by: Jaewon Lee <jaewon.lee@xilinx.com> Signed-off-by: Alejandro Enedino Hernandez Samaniego <alejandr@xilinx.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/recipes-devtools/python/python3/0001-main.c-if-OEPYTHON3HOME-is-set-use-instead-of-PYTHON.patch35
-rw-r--r--meta/recipes-devtools/python/python3_3.5.6.bb6
2 files changed, 40 insertions, 1 deletions
diff --git a/meta/recipes-devtools/python/python3/0001-main.c-if-OEPYTHON3HOME-is-set-use-instead-of-PYTHON.patch b/meta/recipes-devtools/python/python3/0001-main.c-if-OEPYTHON3HOME-is-set-use-instead-of-PYTHON.patch
new file mode 100644
index 0000000..48d4f73
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/0001-main.c-if-OEPYTHON3HOME-is-set-use-instead-of-PYTHON.patch
@@ -0,0 +1,35 @@
1From ffe7797637f08cd6ee4c82e2d67462c5e194d30a Mon Sep 17 00:00:00 2001
2From: Jaewon Lee <jaewon.lee@xilinx.com>
3Date: Thu, 25 Apr 2019 15:34:26 -0700
4Subject: [PATCH] main.c: if OEPYTHON3HOME is set use instead of PYTHONHOME
5
6There is one variable PYTHONHOME to determine where libraries are coming
7from for both python2 and python3. This becomes an issue if only one has
8libraries in the specified PYTHONHOME path, but they are using the same
9PYTHONHOME. Creating another variable OEPYTHON3HOME to allow for a way
10to set a different path for python3
11
12Signed-off-by: Jaewon Lee <jaewon.lee@xilinx.com>
13RP: Backported to 3.5.6 (code totally different to original path for
14later python versions)
15Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
16
17---
18 Modules/main.c | 17 +++++++++++++----
19 1 file changed, 13 insertions(+), 4 deletions(-)
20
21Index: Python-3.5.6/Python/pylifecycle.c
22===================================================================
23--- Python-3.5.6.orig/Python/pylifecycle.c
24+++ Python-3.5.6/Python/pylifecycle.c
25@@ -864,7 +864,9 @@ Py_GetPythonHome(void)
26 {
27 wchar_t *home = default_home;
28 if (home == NULL && !Py_IgnoreEnvironmentFlag) {
29- char* chome = Py_GETENV("PYTHONHOME");
30+ char* chome = Py_GETENV("OEPYTHON3HOME");
31+ if (!chome)
32+ chome = Py_GETENV("PYTHONHOME");
33 if (chome) {
34 size_t size = Py_ARRAY_LENGTH(env_home);
35 size_t r = mbstowcs(env_home, chome, size);
diff --git a/meta/recipes-devtools/python/python3_3.5.6.bb b/meta/recipes-devtools/python/python3_3.5.6.bb
index b2f8a3d..4633a3d 100644
--- a/meta/recipes-devtools/python/python3_3.5.6.bb
+++ b/meta/recipes-devtools/python/python3_3.5.6.bb
@@ -50,6 +50,10 @@ SRC_URI += "\
50 file://CVE-2019-9636.patch \ 50 file://CVE-2019-9636.patch \
51 " 51 "
52 52
53SRC_URI_append_class-nativesdk = " \
54 file://0001-main.c-if-OEPYTHON3HOME-is-set-use-instead-of-PYTHON.patch \
55 "
56
53inherit multilib_header python3native update-alternatives qemu ptest 57inherit multilib_header python3native update-alternatives qemu ptest
54 58
55MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}" 59MULTILIB_SUFFIX = "${@d.getVar('base_libdir',1).split('/')[-1]}"
@@ -184,7 +188,7 @@ do_install() {
184} 188}
185 189
186do_install_append_class-nativesdk () { 190do_install_append_class-nativesdk () {
187 create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} PYTHONHOME='${prefix}' TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1' 191 create_wrapper ${D}${bindir}/python${PYTHON_MAJMIN} OEPYTHON3HOME='${prefix}' TERMINFO_DIRS='${sysconfdir}/terminfo:/etc/terminfo:/usr/share/terminfo:/usr/share/misc/terminfo:/lib/terminfo' PYTHONNOUSERSITE='1'
188} 192}
189 193
190SSTATE_SCAN_FILES += "Makefile" 194SSTATE_SCAN_FILES += "Makefile"