Add & utilize a simple_exec utility function
(Bitbake rev: 5ead16f14f996bcbb2fb14277b8ce5a9317b8160) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
This commit is contained in:
parent
94b60d1247
commit
3995546222
|
@ -58,7 +58,7 @@ def fire_class_handlers(event, d):
|
||||||
event.data = d
|
event.data = d
|
||||||
if type(h).__name__ == "code":
|
if type(h).__name__ == "code":
|
||||||
locals = {"e": event}
|
locals = {"e": event}
|
||||||
exec h in bb.utils._context, locals
|
bb.utils.simple_exec(h, locals)
|
||||||
bb.utils.better_eval("tmpHandler(e)", locals)
|
bb.utils.better_eval("tmpHandler(e)", locals)
|
||||||
else:
|
else:
|
||||||
h(event)
|
h(event)
|
||||||
|
|
|
@ -222,6 +222,9 @@ def better_exec(code, context, text, realfile):
|
||||||
|
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
def simple_exec(code, context):
|
||||||
|
exec code in _context, context
|
||||||
|
|
||||||
def better_eval(source, locals):
|
def better_eval(source, locals):
|
||||||
return eval(source, _context, locals)
|
return eval(source, _context, locals)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue