diff options
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/event.py | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index ed9e4a6adc..9a07ed5c0a 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py | |||
@@ -62,18 +62,13 @@ def fire_class_handlers(event, d): | |||
62 | if isinstance(event, logging.LogRecord): | 62 | if isinstance(event, logging.LogRecord): |
63 | return | 63 | return |
64 | 64 | ||
65 | for handler in _handlers: | 65 | for handler in _handlers.itervalues(): |
66 | h = _handlers[handler] | ||
67 | event.data = d | 66 | event.data = d |
68 | if type(h).__name__ == "code": | 67 | ret = handler(event) |
69 | locals = {"e": event} | 68 | if ret is not None: |
70 | bb.utils.simple_exec(h, locals) | 69 | warnings.warn("Using Handled/NotHandled in event handlers is deprecated", |
71 | ret = bb.utils.better_eval("tmpHandler(e)", locals) | 70 | DeprecationWarning, stacklevel = 2) |
72 | if ret is not None: | 71 | |
73 | warnings.warn("Using Handled/NotHandled in event handlers is deprecated", | ||
74 | DeprecationWarning, stacklevel = 2) | ||
75 | else: | ||
76 | h(event) | ||
77 | del event.data | 72 | del event.data |
78 | 73 | ||
79 | ui_queue = [] | 74 | ui_queue = [] |
@@ -148,7 +143,10 @@ def register(name, handler): | |||
148 | if isinstance(handler, basestring): | 143 | if isinstance(handler, basestring): |
149 | tmp = "def tmpHandler(e):\n%s" % handler | 144 | tmp = "def tmpHandler(e):\n%s" % handler |
150 | comp = bb.utils.better_compile(tmp, "tmpHandler(e)", "bb.event._registerCode") | 145 | comp = bb.utils.better_compile(tmp, "tmpHandler(e)", "bb.event._registerCode") |
151 | _handlers[name] = comp | 146 | env = {} |
147 | bb.utils.simple_exec(comp, env) | ||
148 | func = bb.utils.better_eval("tmpHandler", env) | ||
149 | _handlers[name] = func | ||
152 | else: | 150 | else: |
153 | _handlers[name] = handler | 151 | _handlers[name] = handler |
154 | 152 | ||