summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python3/0001-main.c-if-OEPYTHON3HOME-is-set-use-instead-of-PYTHON.patch
diff options
context:
space:
mode:
authorJaewon Lee <jaewon.lee@xilinx.com>2019-04-25 16:02:21 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2019-04-29 14:16:30 +0100
commit4a42d6907ab3fb1e890b82c2ac9427b742ad5a4b (patch)
tree46e9bc6ed66e4b54ebbf9897b67796343209f55a /meta/recipes-devtools/python/python3/0001-main.c-if-OEPYTHON3HOME-is-set-use-instead-of-PYTHON.patch
parentdfd5d84ecf930623dbb297c1c0f9b77f374314c3 (diff)
downloadpoky-4a42d6907ab3fb1e890b82c2ac9427b742ad5a4b.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) 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>
Diffstat (limited to 'meta/recipes-devtools/python/python3/0001-main.c-if-OEPYTHON3HOME-is-set-use-instead-of-PYTHON.patch')
-rw-r--r--meta/recipes-devtools/python/python3/0001-main.c-if-OEPYTHON3HOME-is-set-use-instead-of-PYTHON.patch47
1 files changed, 47 insertions, 0 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 0000000000..06eb2bd35b
--- /dev/null
+++ b/meta/recipes-devtools/python/python3/0001-main.c-if-OEPYTHON3HOME-is-set-use-instead-of-PYTHON.patch
@@ -0,0 +1,47 @@
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>
13---
14 Modules/main.c | 17 +++++++++++++----
15 1 file changed, 13 insertions(+), 4 deletions(-)
16
17diff --git a/Modules/main.c b/Modules/main.c
18index a745381..b553e30 100644
19--- a/Modules/main.c
20+++ b/Modules/main.c
21@@ -1855,10 +1855,19 @@ config_init_home(_PyCoreConfig *config)
22 }
23 return _Py_INIT_OK();
24 }
25-
26- int res = config_get_env_var_dup(&home, L"PYTHONHOME", "PYTHONHOME");
27- if (res < 0) {
28- return DECODE_LOCALE_ERR("PYTHONHOME", res);
29+ int res;
30+ const char *oepython3home = config_get_env_var("OEPYTHON3HOME");
31+ if (oepython3home) {
32+ res = config_get_env_var_dup(&home, L"OEPYTHON3HOME", "OEPYTHON3HOME");
33+ if (res < 0) {
34+ return DECODE_LOCALE_ERR("OEPYTHON3HOME", res);
35+ }
36+ }
37+ else {
38+ res = config_get_env_var_dup(&home, L"PYTHONHOME", "PYTHONHOME");
39+ if (res < 0) {
40+ return DECODE_LOCALE_ERR("PYTHONHOME", res);
41+ }
42 }
43 config->home = home;
44 return _Py_INIT_OK();
45--
462.7.4
47