summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/parse/ast.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index b7eaff1c69..dfc0b02245 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -125,17 +125,18 @@ class MethodNode(AstNode):
125 self.body = body 125 self.body = body
126 126
127 def eval(self, data): 127 def eval(self, data):
128 text = '\n'.join(self.body)
128 if self.func_name == "__anonymous": 129 if self.func_name == "__anonymous":
129 funcname = ("__anon_%s_%s" % (self.lineno, self.filename.translate(string.maketrans('/.+-', '____')))) 130 funcname = ("__anon_%s_%s" % (self.lineno, self.filename.translate(string.maketrans('/.+-', '____'))))
130 if not funcname in bb.methodpool._parsed_fns: 131 if not funcname in bb.methodpool._parsed_fns:
131 text = "def %s(d):\n" % (funcname) + '\n'.join(self.body) 132 text = "def %s(d):\n" % (funcname) + text
132 bb.methodpool.insert_method(funcname, text, self.filename) 133 bb.methodpool.insert_method(funcname, text, self.filename)
133 anonfuncs = data.getVar('__BBANONFUNCS') or [] 134 anonfuncs = data.getVar('__BBANONFUNCS') or []
134 anonfuncs.append(funcname) 135 anonfuncs.append(funcname)
135 data.setVar('__BBANONFUNCS', anonfuncs) 136 data.setVar('__BBANONFUNCS', anonfuncs)
136 else: 137 else:
137 data.setVarFlag(self.func_name, "func", 1) 138 data.setVarFlag(self.func_name, "func", 1)
138 data.setVar(self.func_name, '\n'.join(self.body)) 139 data.setVar(self.func_name, text)
139 140
140class PythonMethodNode(AstNode): 141class PythonMethodNode(AstNode):
141 def __init__(self, filename, lineno, function, modulename, body): 142 def __init__(self, filename, lineno, function, modulename, body):