diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-08-22 13:54:47 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-08-23 09:22:44 +0100 |
commit | ce682323a918e4c59d854745865b0950610ce29b (patch) | |
tree | b51d638ec40ed7bff8823cf70d132820c69c4a50 | |
parent | 9e8ba3036d8dde69f3a67925e6c1028469220f1e (diff) | |
download | poky-ce682323a918e4c59d854745865b0950610ce29b.tar.gz |
bitbake: ast: Extract text variable in PythonMethodNode
(Bitbake rev: 2e98f740b4a57a3467b1a00b1ebc1aaee33a8ff0)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | bitbake/lib/bb/parse/ast.py | 5 |
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 | ||
140 | class PythonMethodNode(AstNode): | 141 | class PythonMethodNode(AstNode): |
141 | def __init__(self, filename, lineno, function, modulename, body): | 142 | def __init__(self, filename, lineno, function, modulename, body): |