diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-03-30 20:06:07 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-07-02 15:41:31 +0100 |
commit | 94b60d1247be4ce42eaefafe13e73169bd978bd7 (patch) | |
tree | 3a8ed098cc96b5ee63c6652c8d49cda6c99a5524 /bitbake/lib/bb/event.py | |
parent | eb167737041d8754988d153e0495268f03b6e809 (diff) | |
download | poky-94b60d1247be4ce42eaefafe13e73169bd978bd7.tar.gz |
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>
Diffstat (limited to 'bitbake/lib/bb/event.py')
-rw-r--r-- | bitbake/lib/bb/event.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index afd5bf57c1..8559858f04 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py | |||
@@ -48,13 +48,18 @@ _handlers = {} | |||
48 | _ui_handlers = {} | 48 | _ui_handlers = {} |
49 | _ui_handler_seq = 0 | 49 | _ui_handler_seq = 0 |
50 | 50 | ||
51 | # For compatibility | ||
52 | bb.utils._context["NotHandled"] = NotHandled | ||
53 | bb.utils._context["Handled"] = Handled | ||
54 | |||
51 | def fire_class_handlers(event, d): | 55 | def fire_class_handlers(event, d): |
52 | for handler in _handlers: | 56 | for handler in _handlers: |
53 | h = _handlers[handler] | 57 | h = _handlers[handler] |
54 | event.data = d | 58 | event.data = d |
55 | if type(h).__name__ == "code": | 59 | if type(h).__name__ == "code": |
56 | exec(h) | 60 | locals = {"e": event} |
57 | tmpHandler(event) | 61 | exec h in bb.utils._context, locals |
62 | bb.utils.better_eval("tmpHandler(e)", locals) | ||
58 | else: | 63 | else: |
59 | h(event) | 64 | h(event) |
60 | del event.data | 65 | del event.data |