1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-01 00:59:48 +00:00

Consolidate the exec/eval bits, switch anonfunc to better_exec, etc

The methodpool, ${@} expansions, anonymous python functions, event handlers
now all run with the same global context, ensuring a consistent environment
for them.  Added a bb.utils.better_eval function which does an eval() with the
same globals as better_exec.

(Bitbake rev: 424d7e267b009cc19b8503eadab782736d9597d0)

Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
Chris Larson
2010-03-30 20:06:07 -07:00
committed by Richard Purdie
parent eb16773704
commit 94b60d1247
6 changed files with 36 additions and 53 deletions
+7 -2
View File
@@ -48,13 +48,18 @@ _handlers = {}
_ui_handlers = {}
_ui_handler_seq = 0
# For compatibility
bb.utils._context["NotHandled"] = NotHandled
bb.utils._context["Handled"] = Handled
def fire_class_handlers(event, d):
for handler in _handlers:
h = _handlers[handler]
event.data = d
if type(h).__name__ == "code":
exec(h)
tmpHandler(event)
locals = {"e": event}
exec h in bb.utils._context, locals
bb.utils.better_eval("tmpHandler(e)", locals)
else:
h(event)
del event.data