summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-03-31 08:52:41 -0700
committerChris Larson <chris_larson@mentor.com>2010-03-31 09:05:07 -0700
commit5ead16f14f996bcbb2fb14277b8ce5a9317b8160 (patch)
tree41f982a88d5d9eba3b02c7e49b2f3057652f7127
parent424d7e267b009cc19b8503eadab782736d9597d0 (diff)
downloadbitbake-5ead16f14f996bcbb2fb14277b8ce5a9317b8160.tar.gz
Add & utilize a simple_exec utility function
Signed-off-by: Chris Larson <chris_larson@mentor.com>
-rw-r--r--lib/bb/event.py2
-rw-r--r--lib/bb/utils.py3
2 files changed, 4 insertions, 1 deletions
diff --git a/lib/bb/event.py b/lib/bb/event.py
index 8559858f0..f49f71cf7 100644
--- a/lib/bb/event.py
+++ b/lib/bb/event.py
@@ -58,7 +58,7 @@ def fire_class_handlers(event, d):
event.data = d
if type(h).__name__ == "code":
locals = {"e": event}
- exec h in bb.utils._context, locals
+ bb.utils.simple_exec(h, locals)
bb.utils.better_eval("tmpHandler(e)", locals)
else:
h(event)
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index de0f3d346..27233245a 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -210,6 +210,9 @@ def better_exec(code, context, text, realfile):
raise
+def simple_exec(code, context):
+ exec code in _context, context
+
def better_eval(source, locals):
return eval(source, _context, locals)