diff options
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/build.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index 1cd546a712..d20ee065b2 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py @@ -229,17 +229,13 @@ def exec_func(func, d, dirs = None): exec_func_shell(func, d, runfile, cwd=adir) _functionfmt = """ -def {function}(d): -{body} - {function}(d) """ logformatter = bb.msg.BBLogFormatter("%(levelname)s: %(message)s") def exec_func_python(func, d, runfile, cwd=None): """Execute a python BB 'function'""" - bbfile = d.getVar('FILE', True) - code = _functionfmt.format(function=func, body=d.getVar(func, False)) + code = _functionfmt.format(function=func) bb.utils.mkdirhier(os.path.dirname(runfile)) with open(runfile, 'w') as script: bb.data.emit_func_python(func, script, d) @@ -254,8 +250,13 @@ def exec_func_python(func, d, runfile, cwd=None): bb.debug(2, "Executing python function %s" % func) try: - comp = utils.better_compile(code, func, bbfile) - utils.better_exec(comp, {"d": d}, code, bbfile) + text = "def %s(d):\n%s" % (func, d.getVar(func, False)) + fn = d.getVarFlag(func, "filename", False) + lineno = int(d.getVarFlag(func, "lineno", False)) + bb.methodpool.insert_method(func, text, fn, lineno - 1) + + comp = utils.better_compile(code, func, "exec_python_func() autogenerated") + utils.better_exec(comp, {"d": d}, code, "exec_python_func() autogenerated") except (bb.parse.SkipRecipe, bb.build.FuncFailed): raise except: |