From 3995546222c18e5c3ca2d43a843b051e7107ce1c Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Wed, 31 Mar 2010 08:52:41 -0700 Subject: Add & utilize a simple_exec utility function (Bitbake rev: 5ead16f14f996bcbb2fb14277b8ce5a9317b8160) Signed-off-by: Chris Larson Signed-off-by: Richard Purdie --- bitbake/lib/bb/event.py | 2 +- bitbake/lib/bb/utils.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) (limited to 'bitbake/lib/bb') diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 8559858f0..f49f71cf7 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/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/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 50e9402a2..2e3937ec1 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -222,6 +222,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) -- cgit v1.2.3