summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Larson <chris_larson@mentor.com>2016-04-30 12:43:53 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-06 10:18:12 +0100
commitcd20dd057b74fac39a0b635e479ccfdcb62452fc (patch)
treebabf32d2de77ea576795fdb78fe53872f972ca4e
parent2d2d3121880d65e52cdffe6b6f869aa3f2dd6410 (diff)
downloadpoky-cd20dd057b74fac39a0b635e479ccfdcb62452fc.tar.gz
bitbake: bb.event: handle __builtins__ as a module
Fixes pypy support. (Bitbake rev: a3e5d9337f5400aab13df63f261e750178f8a661) Signed-off-by: Christopher Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/event.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 5ffe89eae3..5a03a31f43 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -72,11 +72,16 @@ _catchall_handlers = {}
72_eventfilter = None 72_eventfilter = None
73_uiready = False 73_uiready = False
74 74
75if hasattr(__builtins__, '__setitem__'):
76 builtins = __builtins__
77else:
78 builtins = __builtins__.__dict__
79
75def execute_handler(name, handler, event, d): 80def execute_handler(name, handler, event, d):
76 event.data = d 81 event.data = d
77 addedd = False 82 addedd = False
78 if 'd' not in __builtins__: 83 if 'd' not in builtins:
79 __builtins__['d'] = d 84 builtins['d'] = d
80 addedd = True 85 addedd = True
81 try: 86 try:
82 ret = handler(event) 87 ret = handler(event)
@@ -94,7 +99,7 @@ def execute_handler(name, handler, event, d):
94 finally: 99 finally:
95 del event.data 100 del event.data
96 if addedd: 101 if addedd:
97 del __builtins__['d'] 102 del builtins['d']
98 103
99def fire_class_handlers(event, d): 104def fire_class_handlers(event, d):
100 if isinstance(event, logging.LogRecord): 105 if isinstance(event, logging.LogRecord):