summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/event.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-19 09:27:14 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-06-23 11:57:57 +0100
commitdf123ddab43a221cc26028e0aff211ac34c1eafc (patch)
treeaab45f1f73e8ac30496a4e194fdd7e8ef85b9cb9 /bitbake/lib/bb/event.py
parent69b69193411849de71cf7c81735c3239e28a2940 (diff)
downloadpoky-df123ddab43a221cc26028e0aff211ac34c1eafc.tar.gz
bitbake: event: Inject 'd' into event handlers
To quote Chris Larson: """ e.data.getVar() gets a bit old in a large event handler, and it means a simple handler has to be modified if switching between an event handler (e.g. RecipeParsed) and anonymous python. I think it would make sense to restore the 'd' convention here to align with python elsewhere. It'd just be a convenience, d==e.data, to avoid the common pattern of setting it at the top of the event handler. """ I couldn't find a way to inject 'd' via locals/globals due to the use of a function parameter so this left __builtins__ as the only way I could find to make this work. [YOCTO #7668] (Bitbake rev: 44ac81e5281fb62ad00e2f79a9d754118ea62526) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/event.py')
-rw-r--r--bitbake/lib/bb/event.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index ba0de11cd2..f0391b8565 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -72,6 +72,7 @@ _eventfilter = None
72 72
73def execute_handler(name, handler, event, d): 73def execute_handler(name, handler, event, d):
74 event.data = d 74 event.data = d
75 __builtins__['d'] = d
75 try: 76 try:
76 ret = handler(event) 77 ret = handler(event)
77 except (bb.parse.SkipRecipe, bb.BBHandledException): 78 except (bb.parse.SkipRecipe, bb.BBHandledException):
@@ -87,6 +88,7 @@ def execute_handler(name, handler, event, d):
87 raise 88 raise
88 finally: 89 finally:
89 del event.data 90 del event.data
91 del __builtins__['d']
90 92
91def fire_class_handlers(event, d): 93def fire_class_handlers(event, d):
92 if isinstance(event, logging.LogRecord): 94 if isinstance(event, logging.LogRecord):