From: Trevor Woerner <twoerner@gmail.com>
To: yocto-patches@lists.yoctoproject.org
Cc: Bruce Ashfield <bruce.ashfield@gmail.com>,
Mark Hatle <mark.hatle@kernel.crashing.org>
Subject: [wic][PATCH 7/9] plugins/source/bootimg_biosplusefi.py: add import os
Date: Fri, 3 Apr 2026 14:36:42 -0400 [thread overview]
Message-ID: <20260403183644.2783267-8-twoerner@gmail.com> (raw)
In-Reply-To: <20260403183644.2783267-1-twoerner@gmail.com>
BitBake's bb/build.py:55 deliberately injects os (and bb) into Python's
__builtins__ at the module level:
# When we execute a Python function, we'd like certain things
# in all namespaces, hence we add them to __builtins__.
# If we do not do this and use the exec globals, they will
# not be available to subfunctions.
if hasattr(__builtins__, '__setitem__'):
builtins = __builtins__
else:
builtins = __builtins__.__dict__
builtins['bb'] = bb
builtins['os'] = os
When wic was part of oe-core this injection would occur, and once
os is in __builtins__, Python's name resolution (locals -> globals
-> builtins) finds it for any code in the process, even modules
that never explicitly import os. So when bootimg_biosplusefi.py's
__instanciateSubClasses referenced os.path.join(...), Python resolved os
from builtins rather than the module's own globals.
Since wic is now split out from oe-core (and bitbake) this plugin fails
with:
NameError: name 'os' is not defined.
Therefore, add "import os" to bootimg_biosplusefi.py.
NOTE: this commit does not work as-is, but is being provided in order to
explicitly show a clean transition from oe-core
AI-Generated: codex/claude-opus-4-6 (xhigh)
Reviewed-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Reviewed-by: Mark Hatle <mark.hatle@kernel.crashing.org>
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
src/wic/plugins/source/bootimg_biosplusefi.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/wic/plugins/source/bootimg_biosplusefi.py b/src/wic/plugins/source/bootimg_biosplusefi.py
index 4279ddded83a..cd7cd270a970 100644
--- a/src/wic/plugins/source/bootimg_biosplusefi.py
+++ b/src/wic/plugins/source/bootimg_biosplusefi.py
@@ -19,6 +19,7 @@
# William Bourque <wbourque [at) gmail.com>
import types
+import os
from wic.pluginbase import SourcePlugin
from importlib.machinery import SourceFileLoader
--
2.51.0
next prev parent reply other threads:[~2026-04-03 18:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-03 18:36 [wic][PATCH 0/9] standalone wic repository Trevor Woerner
2026-04-03 18:36 ` [wic][PATCH 1/9] re-organize for python src layout packaging Trevor Woerner
2026-04-03 18:36 ` [wic][PATCH 2/9] move example *wks files Trevor Woerner
2026-04-03 18:36 ` [wic][PATCH 3/9] create python hatch project Trevor Woerner
2026-04-03 18:36 ` [wic][PATCH 4/9] add oe-core and bitbake helper packages Trevor Woerner
2026-04-03 18:36 ` [wic][PATCH 5/9] bump version: 0.2.0 -> 0.3.0 Trevor Woerner
2026-04-03 18:36 ` [wic][PATCH 6/9] cli.py: remove bitbake coupling Trevor Woerner
2026-04-03 18:36 ` Trevor Woerner [this message]
2026-04-03 18:36 ` [wic][PATCH 8/9] ksparser.py: search for *inc files Trevor Woerner
2026-04-03 18:36 ` [wic][PATCH 9/9] cli.py: fix main() for standalone mode Trevor Woerner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260403183644.2783267-8-twoerner@gmail.com \
--to=twoerner@gmail.com \
--cc=bruce.ashfield@gmail.com \
--cc=mark.hatle@kernel.crashing.org \
--cc=yocto-patches@lists.yoctoproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.