On Ubuntu 20.04.1 LTS with Python 3.8.2 "devtool modify" fails with
Exception: ModuleNotFoundError: No module named '_sysconfigdata'
e.g.: devtool modify --no-same-dir --branch fit u-boot ~/ws/w/dtool/u-boot-fit
ERROR: Error executing a python function in exec_python_func() autogenerated:
The stack trace of python calls that resulted in this exception/failure was:
File: 'exec_python_func() autogenerated', lineno: 2, function: <module>
0001:
*** 0002:devtool_post_unpack(d)
0003:
[...]
File: '/usr/lib/python3.8/sysconfig.py', lineno: 421, function: _init_posix
0417:def _init_posix(vars):
0418: """Initialize the module as appropriate for POSIX systems."""
0419: # _sysconfigdata is generated at build time, see
_generate_posix_vars()
0420: name = _get_sysconfigdata_name()
*** 0421: _temp = __import__(name, globals(), locals(),
['build_time_vars'], 0)
0422: build_time_vars = _temp.build_time_vars
0423: vars.update(build_time_vars)
0424:
0425:def _init_non_posix(vars):
Exception: ModuleNotFoundError: No module named '_sysconfigdata'
It happens because u-boot (and likely other recipes) eventually inherits
python3native.bbclass that sets _PYTHON_SYSCONFIGDATA_NAME="_sysconfigdata"
and this affects host Python.
Hence, unset _PYTHON_SYSCONFIGDATA_NAME for devtool completely.
Signed-off-by: Grygorii Tertychnyi <[email protected]>
---
meta/classes/devtool-source.bbclass | 2 ++
1 file changed, 2 insertions(+)
diff --git a/meta/classes/devtool-source.bbclass
b/meta/classes/devtool-source.bbclass
index 280d6009f3c2..95d6fe7a29e8 100644
--- a/meta/classes/devtool-source.bbclass
+++ b/meta/classes/devtool-source.bbclass
@@ -22,6 +22,8 @@
DEVTOOL_TEMPDIR ?= ""
DEVTOOL_PATCH_SRCDIR = "${DEVTOOL_TEMPDIR}/patchworkdir"
+# host Python fails to import correct _sysconfigdata if this variable is set
+_PYTHON_SYSCONFIGDATA_NAME[unexport] = "1"
python() {
tempdir = d.getVar('DEVTOOL_TEMPDIR')
--
2.25.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#141905):
https://lists.openembedded.org/g/openembedded-core/message/141905
Mute This Topic: https://lists.openembedded.org/mt/76450895/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-