Bug 15108 - python3targetconfig.bbclass: PYTHONPATH is overwritten instead of extended
Summary: python3targetconfig.bbclass: PYTHONPATH is overwritten instead of extended
Status: RESOLVED FIXED
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: oe-core other (show other bugs)
Version: unspecified
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 4.3 M1
Assignee: Johannes Schrimpf
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2023-04-19 10:54 UTC by Johannes Schrimpf
Modified: 2023-06-20 10:28 UTC (History)
3 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Schrimpf 2023-04-19 10:54:29 UTC
I came over this error in poky, but see the same commit is present in openembedded-core as the change origins from there.

These commits set the PYTHONPATH in line 15, overwriting the current PYTHONPATH variable instead of extending the path as was the behaviour before the commit.

https://github.com/openembedded/openembedded-core/commit/c9617c03bceee54dc540318cada392799b137bd5
https://github.com/yoctoproject/poky/commit/af4284d39d8922ef1fcd884fe099aff52c7999f2

This leads to build errors of recipes where the PYTHONPATH is set before setup_target_config is run. I observed this error when building recipes from meta-ros.

I testet this in the poky repo: Adding :$PYTHONPATH (similar as with the PATH variable the line below) at the end of this line solves the problem and the recipes build without problem.

Example for a fix:

diff --git a/meta/classes-recipe/python3targetconfig.bbclass b/meta/classes-recipe/python3targetconfig.bbclass
index 22305fe176..08bc619398 100644
--- a/meta/classes-recipe/python3targetconfig.bbclass
+++ b/meta/classes-recipe/python3targetconfig.bbclass
@@ -12,7 +12,7 @@ DEPENDS:append = " ${EXTRA_PYTHON_DEPENDS}"
 
 setup_target_config() {
         export _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
-        export PYTHONPATH=${STAGING_LIBDIR}/python-sysconfigdata
+        export PYTHONPATH=${STAGING_LIBDIR}/python-sysconfigdata:$PYTHONPATH
         export PATH=${STAGING_EXECPREFIXDIR}/python-target-config/:$PATH
 }
Comment 1 Randy MacLeod 2023-04-20 14:49:14 UTC
Johannes, Seems like a good idea. Can you send a patch to the list?
Comment 2 Johannes Schrimpf 2023-04-25 10:35:58 UTC
I sent a patch to the openembedded-core mailing list.
https://patchwork.yoctoproject.org/project/oe-core/patch/20230425091532.8086-1-dev@loewen-email.de/

Are the patches automatically added to the poky repo as well or do I need to send the patch to an additional mailing list?
Comment 3 Alexander Kanavin 2023-04-26 10:59:10 UTC
It will get into poky automatically, oe-core is the only place you need to submit to.