aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/event.py
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-03-30 20:06:07 -0700
committerChris Larson <chris_larson@mentor.com>2010-03-30 20:06:09 -0700
commit424d7e267b009cc19b8503eadab782736d9597d0 (patch)
treeaeba768adb121e1f562bd6b39e6c7e2897d701e5 /lib/bb/event.py
parent97da0cebbaf4dd1b46e58bd2e80cab6c007ae7c9 (diff)
downloadbitbake-424d7e267b009cc19b8503eadab782736d9597d0.tar.gz
bitbake-424d7e267b009cc19b8503eadab782736d9597d0.tar.bz2
bitbake-424d7e267b009cc19b8503eadab782736d9597d0.zip
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. Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'lib/bb/event.py')
-rw-r--r--lib/bb/event.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/bb/event.py b/lib/bb/event.py
index afd5bf57..8559858f 100644
--- a/lib/bb/event.py
+++ b/lib/bb/event.py
@@ -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