diff options
author | Holger Freyther <ich@tamarin.(none)> | 2009-05-18 19:56:36 +0200 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-02-15 17:06:55 +0000 |
commit | 4320386deb54866d643edeb29dd9567821f1cb26 (patch) | |
tree | a7c9f68d17fe85b2ccd85553e30e82eef3d469f4 /bitbake | |
parent | 4b25b519ae46b283988a1847e56a19b01269b3a4 (diff) | |
download | openembedded-core-4320386deb54866d643edeb29dd9567821f1cb26.tar.gz openembedded-core-4320386deb54866d643edeb29dd9567821f1cb26.tar.bz2 openembedded-core-4320386deb54866d643edeb29dd9567821f1cb26.zip |
bitbake: [parser] Move the finalise into the ast as well
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/parse/ast.py | 39 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/BBHandler.py | 45 |
2 files changed, 41 insertions, 43 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index 8e7ba7fde8..f21b0aeb45 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py @@ -197,3 +197,42 @@ def handleInherit(statements, m, d): n = __word__.findall(files) bb.parse.BBHandler.inherit(statements, n, d) +def finalise(fn, d): + bb.data.expandKeys(d) + bb.data.update_data(d) + anonqueue = bb.data.getVar("__anonqueue", d, 1) or [] + body = [x['content'] for x in anonqueue] + flag = { 'python' : 1, 'func' : 1 } + bb.data.setVar("__anonfunc", "\n".join(body), d) + bb.data.setVarFlags("__anonfunc", flag, d) + from bb import build + try: + t = bb.data.getVar('T', d) + bb.data.setVar('T', '${TMPDIR}/anonfunc/', d) + anonfuncs = bb.data.getVar('__BBANONFUNCS', d) or [] + code = "" + for f in anonfuncs: + code = code + " %s(d)\n" % f + bb.data.setVar("__anonfunc", code, d) + build.exec_func("__anonfunc", d) + bb.data.delVar('T', d) + if t: + bb.data.setVar('T', t, d) + except Exception, e: + bb.msg.debug(1, bb.msg.domain.Parsing, "Exception when executing anonymous function: %s" % e) + raise + bb.data.delVar("__anonqueue", d) + bb.data.delVar("__anonfunc", d) + bb.data.update_data(d) + + all_handlers = {} + for var in bb.data.getVar('__BBHANDLERS', d) or []: + # try to add the handler + handler = bb.data.getVar(var,d) + bb.event.register(var, handler) + + tasklist = bb.data.getVar('__BBTASKS', d) or [] + bb.build.add_tasks(tasklist, d) + + bb.event.fire(bb.event.RecipeParsed(fn), d) + diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index 46413c5dc3..bb868d1c57 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py @@ -75,47 +75,6 @@ def inherit(statements, files, d): include(statements, fn, file, d, "inherit") __inherit_cache = data.getVar('__inherit_cache', d) or [] - -def finalise(fn, d): - data.expandKeys(d) - data.update_data(d) - anonqueue = data.getVar("__anonqueue", d, 1) or [] - body = [x['content'] for x in anonqueue] - flag = { 'python' : 1, 'func' : 1 } - data.setVar("__anonfunc", "\n".join(body), d) - data.setVarFlags("__anonfunc", flag, d) - from bb import build - try: - t = data.getVar('T', d) - data.setVar('T', '${TMPDIR}/anonfunc/', d) - anonfuncs = data.getVar('__BBANONFUNCS', d) or [] - code = "" - for f in anonfuncs: - code = code + " %s(d)\n" % f - data.setVar("__anonfunc", code, d) - build.exec_func("__anonfunc", d) - data.delVar('T', d) - if t: - data.setVar('T', t, d) - except Exception, e: - bb.msg.debug(1, bb.msg.domain.Parsing, "Exception when executing anonymous function: %s" % e) - raise - data.delVar("__anonqueue", d) - data.delVar("__anonfunc", d) - data.update_data(d) - - all_handlers = {} - for var in data.getVar('__BBHANDLERS', d) or []: - # try to add the handler - handler = data.getVar(var,d) - bb.event.register(var, handler) - - tasklist = data.getVar('__BBTASKS', d) or [] - bb.build.add_tasks(tasklist, d) - - bb.event.fire(bb.event.RecipeParsed(fn), d) - - def handle(fn, d, include, statements): global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__ __body__ = [] @@ -174,7 +133,7 @@ def handle(fn, d, include, statements): else: based = d try: - finalise(fn, based) + ast.finalise(fn, based) except bb.parse.SkipPackage: bb.data.setVar("__SKIPPED", True, based) darray = {"": based} @@ -185,7 +144,7 @@ def handle(fn, d, include, statements): data.setVar('PN', pn + '-' + cls, based) inherit(statements, [cls], based) try: - finalise(fn, based) + ast.finalise(fn, based) except bb.parse.SkipPackage: bb.data.setVar("__SKIPPED", True, based) darray[cls] = based |