diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-03-31 09:14:18 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-07-02 15:41:31 +0100 |
commit | c926e87f47bfef1a367cac732b64a07a2415c91e (patch) | |
tree | 4d75dec6a322864355c0bdfae1ba857b9dea5063 /bitbake/lib/bb/parse | |
parent | 3995546222c18e5c3ca2d43a843b051e7107ce1c (diff) | |
download | poky-c926e87f47bfef1a367cac732b64a07a2415c91e.tar.gz |
Resurrect merged anonfunc execution
(Bitbake rev: 0c2ed40277e157406ea25c858f14c3cebb73c21b)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/parse')
-rw-r--r-- | bitbake/lib/bb/parse/ast.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index d2ae09a4a4..d767882e53 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py | |||
@@ -122,8 +122,12 @@ class MethodNode: | |||
122 | 122 | ||
123 | def eval(self, data): | 123 | def eval(self, data): |
124 | if self.func_name == "__anonymous": | 124 | if self.func_name == "__anonymous": |
125 | funcname = ("__anon_%s_%s" % (self.lineno, self.fn.translate(string.maketrans('/.+-', '____')))) | ||
126 | if not funcname in bb.methodpool._parsed_fns: | ||
127 | text = "def %s(d):\n" % (funcname) + '\n'.join(self.body) | ||
128 | bb.methodpool.insert_method(funcname, text, self.fn) | ||
125 | anonfuncs = bb.data.getVar('__BBANONFUNCS', data) or [] | 129 | anonfuncs = bb.data.getVar('__BBANONFUNCS', data) or [] |
126 | anonfuncs.append((self.fn, "\n".join(self.body))) | 130 | anonfuncs.append(funcname) |
127 | bb.data.setVar('__BBANONFUNCS', anonfuncs, data) | 131 | bb.data.setVar('__BBANONFUNCS', anonfuncs, data) |
128 | else: | 132 | else: |
129 | bb.data.setVarFlag(self.func_name, "func", 1, data) | 133 | bb.data.setVarFlag(self.func_name, "func", 1, data) |
@@ -297,9 +301,10 @@ def finalise(fn, d): | |||
297 | 301 | ||
298 | bb.data.expandKeys(d) | 302 | bb.data.expandKeys(d) |
299 | bb.data.update_data(d) | 303 | bb.data.update_data(d) |
300 | for fn, func in bb.data.getVar("__BBANONFUNCS", d) or []: | 304 | code = [] |
301 | funcdef = "def __anonfunc(d):\n%s\n__anonfunc(d)" % func.rstrip() | 305 | for funcname in bb.data.getVar("__BBANONFUNCS", d) or []: |
302 | bb.utils.better_exec(funcdef, {"d": d}, funcdef, fn) | 306 | code.append("%s(d)" % funcname) |
307 | bb.utils.simple_exec("\n".join(code), {"d": d}) | ||
303 | bb.data.update_data(d) | 308 | bb.data.update_data(d) |
304 | 309 | ||
305 | all_handlers = {} | 310 | all_handlers = {} |