summaryrefslogtreecommitdiff
path: root/bitbake
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2010-03-31 09:14:18 -0700
committerRichard Purdie <rpurdie@linux.intel.com>2010-07-02 15:41:31 +0100
commitc926e87f47bfef1a367cac732b64a07a2415c91e (patch)
tree4d75dec6a322864355c0bdfae1ba857b9dea5063 /bitbake
parent3995546222c18e5c3ca2d43a843b051e7107ce1c (diff)
downloadopenembedded-core-c926e87f47bfef1a367cac732b64a07a2415c91e.tar.gz
openembedded-core-c926e87f47bfef1a367cac732b64a07a2415c91e.tar.bz2
openembedded-core-c926e87f47bfef1a367cac732b64a07a2415c91e.tar.xz
openembedded-core-c926e87f47bfef1a367cac732b64a07a2415c91e.zip
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')
-rw-r--r--bitbake/lib/bb/parse/ast.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index d2ae09a4a..d767882e5 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -122,8 +122,12 @@ class MethodNode:
def eval(self, data):
if self.func_name == "__anonymous":
+ funcname = ("__anon_%s_%s" % (self.lineno, self.fn.translate(string.maketrans('/.+-', '____'))))
+ if not funcname in bb.methodpool._parsed_fns:
+ text = "def %s(d):\n" % (funcname) + '\n'.join(self.body)
+ bb.methodpool.insert_method(funcname, text, self.fn)
anonfuncs = bb.data.getVar('__BBANONFUNCS', data) or []
- anonfuncs.append((self.fn, "\n".join(self.body)))
+ anonfuncs.append(funcname)
bb.data.setVar('__BBANONFUNCS', anonfuncs, data)
else:
bb.data.setVarFlag(self.func_name, "func", 1, data)
@@ -297,9 +301,10 @@ def finalise(fn, d):
bb.data.expandKeys(d)
bb.data.update_data(d)
- for fn, func in bb.data.getVar("__BBANONFUNCS", d) or []:
- funcdef = "def __anonfunc(d):\n%s\n__anonfunc(d)" % func.rstrip()
- bb.utils.better_exec(funcdef, {"d": d}, funcdef, fn)
+ code = []
+ for funcname in bb.data.getVar("__BBANONFUNCS", d) or []:
+ code.append("%s(d)" % funcname)
+ bb.utils.simple_exec("\n".join(code), {"d": d})
bb.data.update_data(d)
all_handlers = {}