python3: split python target configuration into own class
Doh, wrong list! Sorry for the spam.
//E
Den tis 1 dec. 2020 kl 17:27 skrev Ernst Sjöstrand via lists.openembedded.org <[email protected]>:
Quoted 69 lines
From: Alexander Kanavin <[email protected]>
Setting
_PYTHON_SYSCONFIGDATA_NAMEin 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:
5a118d4e7985fa88f04c3611f8db813f0dafce75)Signed-off-by Alexander Kanavin <[email protected]>Signed-off-by Richard Purdie <[email protected]>(cherry picked from commit c9f7ed88a946078c27fa1a62d54d6310fad9d37a)--- meta/classes/python3native.bbclass | 2 -- meta/classes/python3targetconfig.bbclass | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 meta/classes/python3targetconfig.bbclassmeta/classes/python3native.bbclass +0
-2@@ -17,8 +17,6 @@ export STAGING_LIBDIR export PYTHON_LIBRARY="${STAGING_LIBDIR}/lib${PYTHON_DIR}${PYTHON_ABI}.so" export PYTHON_INCLUDE_DIR="${STAGING_INCDIR}/${PYTHON_DIR}${PYTHON_ABI}" -export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata" - # suppress host user's site-packages dirs. export PYTHONNOUSERSITE = "1"meta/classes/python3targetconfig.bbclass new file +15
-1@@ -0,0 +1,15 @@ +inherit python3native + +DEPENDS_append = " python3" + +do_configure_prepend() { + export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata" +} + +do_compile_prepend() { + export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata" +} + +do_install_prepend() { + export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata" +} --2.29.2