diff options
Diffstat (limited to 'bitbake/lib/bb/parse/parse_py')
| -rw-r--r-- | bitbake/lib/bb/parse/parse_py/BBHandler.py | 45 |
1 files changed, 2 insertions, 43 deletions
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): | |||
| 75 | include(statements, fn, file, d, "inherit") | 75 | include(statements, fn, file, d, "inherit") |
| 76 | __inherit_cache = data.getVar('__inherit_cache', d) or [] | 76 | __inherit_cache = data.getVar('__inherit_cache', d) or [] |
| 77 | 77 | ||
| 78 | |||
| 79 | def finalise(fn, d): | ||
| 80 | data.expandKeys(d) | ||
| 81 | data.update_data(d) | ||
| 82 | anonqueue = data.getVar("__anonqueue", d, 1) or [] | ||
| 83 | body = [x['content'] for x in anonqueue] | ||
| 84 | flag = { 'python' : 1, 'func' : 1 } | ||
| 85 | data.setVar("__anonfunc", "\n".join(body), d) | ||
| 86 | data.setVarFlags("__anonfunc", flag, d) | ||
| 87 | from bb import build | ||
| 88 | try: | ||
| 89 | t = data.getVar('T', d) | ||
| 90 | data.setVar('T', '${TMPDIR}/anonfunc/', d) | ||
| 91 | anonfuncs = data.getVar('__BBANONFUNCS', d) or [] | ||
| 92 | code = "" | ||
| 93 | for f in anonfuncs: | ||
| 94 | code = code + " %s(d)\n" % f | ||
| 95 | data.setVar("__anonfunc", code, d) | ||
| 96 | build.exec_func("__anonfunc", d) | ||
| 97 | data.delVar('T', d) | ||
| 98 | if t: | ||
| 99 | data.setVar('T', t, d) | ||
| 100 | except Exception, e: | ||
| 101 | bb.msg.debug(1, bb.msg.domain.Parsing, "Exception when executing anonymous function: %s" % e) | ||
| 102 | raise | ||
| 103 | data.delVar("__anonqueue", d) | ||
| 104 | data.delVar("__anonfunc", d) | ||
| 105 | data.update_data(d) | ||
| 106 | |||
| 107 | all_handlers = {} | ||
| 108 | for var in data.getVar('__BBHANDLERS', d) or []: | ||
| 109 | # try to add the handler | ||
| 110 | handler = data.getVar(var,d) | ||
| 111 | bb.event.register(var, handler) | ||
| 112 | |||
| 113 | tasklist = data.getVar('__BBTASKS', d) or [] | ||
| 114 | bb.build.add_tasks(tasklist, d) | ||
| 115 | |||
| 116 | bb.event.fire(bb.event.RecipeParsed(fn), d) | ||
| 117 | |||
| 118 | |||
| 119 | def handle(fn, d, include, statements): | 78 | def handle(fn, d, include, statements): |
| 120 | global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__ | 79 | global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__ |
| 121 | __body__ = [] | 80 | __body__ = [] |
| @@ -174,7 +133,7 @@ def handle(fn, d, include, statements): | |||
| 174 | else: | 133 | else: |
| 175 | based = d | 134 | based = d |
| 176 | try: | 135 | try: |
| 177 | finalise(fn, based) | 136 | ast.finalise(fn, based) |
| 178 | except bb.parse.SkipPackage: | 137 | except bb.parse.SkipPackage: |
| 179 | bb.data.setVar("__SKIPPED", True, based) | 138 | bb.data.setVar("__SKIPPED", True, based) |
| 180 | darray = {"": based} | 139 | darray = {"": based} |
| @@ -185,7 +144,7 @@ def handle(fn, d, include, statements): | |||
| 185 | data.setVar('PN', pn + '-' + cls, based) | 144 | data.setVar('PN', pn + '-' + cls, based) |
| 186 | inherit(statements, [cls], based) | 145 | inherit(statements, [cls], based) |
| 187 | try: | 146 | try: |
| 188 | finalise(fn, based) | 147 | ast.finalise(fn, based) |
| 189 | except bb.parse.SkipPackage: | 148 | except bb.parse.SkipPackage: |
| 190 | bb.data.setVar("__SKIPPED", True, based) | 149 | bb.data.setVar("__SKIPPED", True, based) |
| 191 | darray[cls] = based | 150 | darray[cls] = based |
