summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kanavin <alex.kanavin@gmail.com>2020-11-13 20:48:50 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-02-11 17:46:12 +0000
commit13ff17c1454d550cab5bf882b5d6e4e7a1c4f987 (patch)
tree45550dda8eb49412ec5bd4168b73ab9302d21a17
parent1511e2f7146925d1deb7e1b029c7f2dbacaf223f (diff)
downloadpoky-13ff17c1454d550cab5bf882b5d6e4e7a1c4f987.tar.gz
python3: split python target configuration into own class
Setting _PYTHON_SYSCONFIGDATA_NAME in python3native class globally was problematic as it was leaking into host python environment, which was causing tracebacks depending on host distro and action (typically anything involving importing sysconfig module). The new class sets the variable only in specific tasks where it is needed, and should be inherited explicitly: - use python3native to run scripts with native python - use python3targetconfig to run scripts with native python if those scripts need to access target config data (such as correct installation directories). This also adds a dependency on target python, so should be used carefully to avoid lengthening builds. (From OE-Core rev: 386c5d3f2283bc16cdab32bd4a5397dc0ef0a5c1) Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 823cbf815d6984e813f0ae812f6a14469150eeff) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/python3native.bbclass2
-rw-r--r--meta/classes/python3targetconfig.bbclass15
2 files changed, 15 insertions, 2 deletions
diff --git a/meta/classes/python3native.bbclass b/meta/classes/python3native.bbclass
index d98fb4c758..2e3a88c126 100644
--- a/meta/classes/python3native.bbclass
+++ b/meta/classes/python3native.bbclass
@@ -17,8 +17,6 @@ export STAGING_LIBDIR
17export PYTHON_LIBRARY="${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so" 17export PYTHON_LIBRARY="${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so"
18export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}" 18export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}"
19 19
20export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
21
22# suppress host user's site-packages dirs. 20# suppress host user's site-packages dirs.
23export PYTHONNOUSERSITE = "1" 21export PYTHONNOUSERSITE = "1"
24 22
diff --git a/meta/classes/python3targetconfig.bbclass b/meta/classes/python3targetconfig.bbclass
new file mode 100644
index 0000000000..640d0c97b6
--- /dev/null
+++ b/meta/classes/python3targetconfig.bbclass
@@ -0,0 +1,15 @@
1inherit python3native
2
3DEPENDS_append = " python3"
4
5do_configure_prepend() {
6 export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
7}
8
9do_compile_prepend() {
10 export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
11}
12
13do_install_prepend() {
14 export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
15}