diff options
Diffstat (limited to 'bitbake/lib/bb/event.py')
-rw-r--r-- | bitbake/lib/bb/event.py | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 97668601a1..303b7a943f 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py | |||
@@ -70,11 +70,6 @@ _uiready = False | |||
70 | _thread_lock = threading.Lock() | 70 | _thread_lock = threading.Lock() |
71 | _thread_lock_enabled = False | 71 | _thread_lock_enabled = False |
72 | 72 | ||
73 | if hasattr(__builtins__, '__setitem__'): | ||
74 | builtins = __builtins__ | ||
75 | else: | ||
76 | builtins = __builtins__.__dict__ | ||
77 | |||
78 | def enable_threadlock(): | 73 | def enable_threadlock(): |
79 | global _thread_lock_enabled | 74 | global _thread_lock_enabled |
80 | _thread_lock_enabled = True | 75 | _thread_lock_enabled = True |
@@ -85,12 +80,8 @@ def disable_threadlock(): | |||
85 | 80 | ||
86 | def execute_handler(name, handler, event, d): | 81 | def execute_handler(name, handler, event, d): |
87 | event.data = d | 82 | event.data = d |
88 | addedd = False | ||
89 | if 'd' not in builtins: | ||
90 | builtins['d'] = d | ||
91 | addedd = True | ||
92 | try: | 83 | try: |
93 | ret = handler(event) | 84 | ret = handler(event, d) |
94 | except (bb.parse.SkipRecipe, bb.BBHandledException): | 85 | except (bb.parse.SkipRecipe, bb.BBHandledException): |
95 | raise | 86 | raise |
96 | except Exception: | 87 | except Exception: |
@@ -104,8 +95,7 @@ def execute_handler(name, handler, event, d): | |||
104 | raise | 95 | raise |
105 | finally: | 96 | finally: |
106 | del event.data | 97 | del event.data |
107 | if addedd: | 98 | |
108 | del builtins['d'] | ||
109 | 99 | ||
110 | def fire_class_handlers(event, d): | 100 | def fire_class_handlers(event, d): |
111 | if isinstance(event, logging.LogRecord): | 101 | if isinstance(event, logging.LogRecord): |
@@ -253,12 +243,12 @@ def register(name, handler, mask=None, filename=None, lineno=None, data=None): | |||
253 | if handler is not None: | 243 | if handler is not None: |
254 | # handle string containing python code | 244 | # handle string containing python code |
255 | if isinstance(handler, str): | 245 | if isinstance(handler, str): |
256 | tmp = "def %s(e):\n%s" % (name, handler) | 246 | tmp = "def %s(e, d):\n%s" % (name, handler) |
257 | try: | 247 | try: |
258 | code = bb.methodpool.compile_cache(tmp) | 248 | code = bb.methodpool.compile_cache(tmp) |
259 | if not code: | 249 | if not code: |
260 | if filename is None: | 250 | if filename is None: |
261 | filename = "%s(e)" % name | 251 | filename = "%s(e, d)" % name |
262 | code = compile(tmp, filename, "exec", ast.PyCF_ONLY_AST) | 252 | code = compile(tmp, filename, "exec", ast.PyCF_ONLY_AST) |
263 | if lineno is not None: | 253 | if lineno is not None: |
264 | ast.increment_lineno(code, lineno-1) | 254 | ast.increment_lineno(code, lineno-1) |