summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaewon Lee <jaewon.lee@xilinx.com>2019-04-25 16:02:21 -0700
committerArmin Kuster <akuster808@gmail.com>2019-05-02 13:35:46 -0700
commit5ae52eb8508c0ba5713489dc4661649c19dceeed (patch)
treee25a642b71fedf8e8d5b3444aa4d5e39b887839c
parentc27cc2355d331e063f170b45728671988a967deb (diff)
downloadopenembedded-core-5ae52eb8508c0ba5713489dc4661649c19dceeed.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] 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> Signed-off-by: Armin Kuster <akuster808@gmail.com>
-rw-r--r--meta/recipes-devtools/python/python3/0001-main.c-if-OEPYTHON3HOME-is-set-use-instead-of-PYTHON.patch47
-rw-r--r--meta/recipes-devtools/python/python3_3.7.2.bb7
2 files changed, 54 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 @@
+From ffe7797637f08cd6ee4c82e2d67462c5e194d30a Mon Sep 17 00:00:00 2001
+From: Jaewon Lee <jaewon.lee@xilinx.com>
+Date: Thu, 25 Apr 2019 15:34:26 -0700
+Subject: [PATCH] main.c: if OEPYTHON3HOME is set use instead of PYTHONHOME
+
+There is one variable PYTHONHOME to determine where libraries are coming
+from for both python2 and python3. This becomes an issue if only one has
+libraries in the specified PYTHONHOME path, but they are using the same
+PYTHONHOME. Creating another variable OEPYTHON3HOME to allow for a way
+to set a different path for python3
+
+Signed-off-by: Jaewon Lee <jaewon.lee@xilinx.com>
+---
+ Modules/main.c | 17 +++++++++++++----
+ 1 file changed, 13 insertions(+), 4 deletions(-)
+
+diff --git a/Modules/main.c b/Modules/main.c
+index a745381..b553e30 100644
+--- a/Modules/main.c
++++ b/Modules/main.c
+@@ -1855,10 +1855,19 @@ config_init_home(_PyCoreConfig *config)
+ }
+ return _Py_INIT_OK();
+ }
+-
+- int res = config_get_env_var_dup(&home, L"PYTHONHOME", "PYTHONHOME");
+- if (res < 0) {
+- return DECODE_LOCALE_ERR("PYTHONHOME", res);
++ int res;
++ const char *oepython3home = config_get_env_var("OEPYTHON3HOME");
++ if (oepython3home) {
++ res = config_get_env_var_dup(&home, L"OEPYTHON3HOME", "OEPYTHON3HOME");
++ if (res < 0) {
++ return DECODE_LOCALE_ERR("OEPYTHON3HOME", res);
++ }
++ }
++ else {
++ res = config_get_env_var_dup(&home, L"PYTHONHOME", "PYTHONHOME");
++ if (res < 0) {
++ return DECODE_LOCALE_ERR("PYTHONHOME", res);
++ }
+ }
+ config->home = home;
+ return _Py_INIT_OK();
+--
+2.7.4
+
diff --git a/meta/recipes-devtools/python/python3_3.7.2.bb b/meta/recipes-devtools/python/python3_3.7.2.bb
index a1d7ace3a2..579febc1d5 100644
--- a/meta/recipes-devtools/python/python3_3.7.2.bb
+++ b/meta/recipes-devtools/python/python3_3.7.2.bb
@@ -29,6 +29,9 @@ SRC_URI_append_class-native = " \
file://0001-distutils-sysconfig-append-STAGING_LIBDIR-python-sys.patch \
file://12-distutils-prefix-is-inside-staging-area.patch \
"
+SRC_URI_append_class-nativesdk = " \
+ file://0001-main.c-if-OEPYTHON3HOME-is-set-use-instead-of-PYTHON.patch \
+ "
SRC_URI[md5sum] = "df6ec36011808205beda239c72f947cb"
SRC_URI[sha256sum] = "d83fe8ce51b1bb48bbcf0550fd265b9a75cdfdfa93f916f9e700aef8444bf1bb"
@@ -132,6 +135,10 @@ do_install_append() {
${D}${libdir}/python-sysconfigdata/_sysconfigdata.py
}
+do_install_append_class-nativesdk () {
+ 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'
+}
+
SSTATE_SCAN_FILES += "Makefile _sysconfigdata.py"
PACKAGE_PREPROCESS_FUNCS += "py_package_preprocess"