summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2011-04-04 09:41:41 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-05-06 15:47:55 +0100
commit8cf28d706b7e70f5835b1bd4da058ec64f520c6c (patch)
treec3a3987a5a330b81f066c5be88b98266aae7a738 /bitbake
parent2d73cd1d32171e8374a1fd77f5988b2fcba46d57 (diff)
downloadast2050-yocto-poky-8cf28d706b7e70f5835b1bd4da058ec64f520c6c.zip
ast2050-yocto-poky-8cf28d706b7e70f5835b1bd4da058ec64f520c6c.tar.gz
event: register event handler functions, not code objects
(Bitbake rev: be647dac9d458ee4b289ff5f66ed95b311d398d8) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/event.py22
1 files changed, 10 insertions, 12 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index ed9e4a6..9a07ed5 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -62,18 +62,13 @@ def fire_class_handlers(event, d):
if isinstance(event, logging.LogRecord):
return
- for handler in _handlers:
- h = _handlers[handler]
+ for handler in _handlers.itervalues():
event.data = d
- if type(h).__name__ == "code":
- locals = {"e": event}
- bb.utils.simple_exec(h, locals)
- ret = bb.utils.better_eval("tmpHandler(e)", locals)
- if ret is not None:
- warnings.warn("Using Handled/NotHandled in event handlers is deprecated",
- DeprecationWarning, stacklevel = 2)
- else:
- h(event)
+ ret = handler(event)
+ if ret is not None:
+ warnings.warn("Using Handled/NotHandled in event handlers is deprecated",
+ DeprecationWarning, stacklevel = 2)
+
del event.data
ui_queue = []
@@ -148,7 +143,10 @@ def register(name, handler):
if isinstance(handler, basestring):
tmp = "def tmpHandler(e):\n%s" % handler
comp = bb.utils.better_compile(tmp, "tmpHandler(e)", "bb.event._registerCode")
- _handlers[name] = comp
+ env = {}
+ bb.utils.simple_exec(comp, env)
+ func = bb.utils.better_eval("tmpHandler", env)
+ _handlers[name] = func
else:
_handlers[name] = handler
OpenPOWER on IntegriCloud