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/lib/bb/parse/ast.py | |
| parent | 4b25b519ae46b283988a1847e56a19b01269b3a4 (diff) | |
| download | poky-4320386deb54866d643edeb29dd9567821f1cb26.tar.gz | |
bitbake: [parser] Move the finalise into the ast as well
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/parse/ast.py')
| -rw-r--r-- | bitbake/lib/bb/parse/ast.py | 39 |
1 files changed, 39 insertions, 0 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): | |||
| 197 | n = __word__.findall(files) | 197 | n = __word__.findall(files) |
| 198 | bb.parse.BBHandler.inherit(statements, n, d) | 198 | bb.parse.BBHandler.inherit(statements, n, d) |
| 199 | 199 | ||
| 200 | def finalise(fn, d): | ||
| 201 | bb.data.expandKeys(d) | ||
| 202 | bb.data.update_data(d) | ||
| 203 | anonqueue = bb.data.getVar("__anonqueue", d, 1) or [] | ||
| 204 | body = [x['content'] for x in anonqueue] | ||
| 205 | flag = { 'python' : 1, 'func' : 1 } | ||
| 206 | bb.data.setVar("__anonfunc", "\n".join(body), d) | ||
| 207 | bb.data.setVarFlags("__anonfunc", flag, d) | ||
| 208 | from bb import build | ||
| 209 | try: | ||
| 210 | t = bb.data.getVar('T', d) | ||
| 211 | bb.data.setVar('T', '${TMPDIR}/anonfunc/', d) | ||
| 212 | anonfuncs = bb.data.getVar('__BBANONFUNCS', d) or [] | ||
| 213 | code = "" | ||
| 214 | for f in anonfuncs: | ||
| 215 | code = code + " %s(d)\n" % f | ||
| 216 | bb.data.setVar("__anonfunc", code, d) | ||
| 217 | build.exec_func("__anonfunc", d) | ||
| 218 | bb.data.delVar('T', d) | ||
| 219 | if t: | ||
| 220 | bb.data.setVar('T', t, d) | ||
| 221 | except Exception, e: | ||
| 222 | bb.msg.debug(1, bb.msg.domain.Parsing, "Exception when executing anonymous function: %s" % e) | ||
| 223 | raise | ||
| 224 | bb.data.delVar("__anonqueue", d) | ||
| 225 | bb.data.delVar("__anonfunc", d) | ||
| 226 | bb.data.update_data(d) | ||
| 227 | |||
| 228 | all_handlers = {} | ||
| 229 | for var in bb.data.getVar('__BBHANDLERS', d) or []: | ||
| 230 | # try to add the handler | ||
| 231 | handler = bb.data.getVar(var,d) | ||
| 232 | bb.event.register(var, handler) | ||
| 233 | |||
| 234 | tasklist = bb.data.getVar('__BBTASKS', d) or [] | ||
| 235 | bb.build.add_tasks(tasklist, d) | ||
| 236 | |||
| 237 | bb.event.fire(bb.event.RecipeParsed(fn), d) | ||
| 238 | |||
