diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 20923b5f08..fa179d8a11 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py @@ -175,7 +175,7 @@ def register(name, handler): _handlers[name] = noop return env = {} - bb.utils.simple_exec(code, env) + bb.utils.better_exec(code, env) func = bb.utils.better_eval(name, env) _handlers[name] = func else: diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index 86f94636b9..b88d5f5b39 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py @@ -320,7 +320,7 @@ def finalize(fn, d, variant = None): code = [] for funcname in d.getVar("__BBANONFUNCS") or []: code.append("%s(d)" % funcname) - bb.utils.simple_exec("\n".join(code), {"d": d}) + bb.utils.better_exec("\n".join(code), {"d": d}) bb.data.update_data(d) tasklist = d.getVar('__BBTASKS') or [] diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index ee4ef73bfc..44a42a0136 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -218,13 +218,15 @@ def better_compile(text, file, realfile, mode = "exec"): raise -def better_exec(code, context, text, realfile = ""): +def better_exec(code, context, text = None, realfile = "", data = None): """ Similiar to better_compile, better_exec will print the lines that are responsible for the error. """ import bb.parse + if not text: + text = code if not hasattr(code, "co_filename"): code = better_compile(code, realfile, realfile) try: