summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Kroon <jacob.kroon@mikrodidakt.se>2014-02-22 17:52:29 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-02-24 12:42:40 +0000
commitf5a344441ac9a6e2d829948050a1ba4c118c3ef5 (patch)
tree06d2e76b28d18df00262062f593b4cfde32e5c91
parent2b7edd5d15592ddda0ca91c95d7ad18f5a030a85 (diff)
downloadpoky-f5a344441ac9a6e2d829948050a1ba4c118c3ef5.tar.gz
poky-f5a344441ac9a6e2d829948050a1ba4c118c3ef5.tar.bz2
poky-f5a344441ac9a6e2d829948050a1ba4c118c3ef5.zip
bitbake: ast: Fix support for anonymous methods in wildcard .bbappend files
When using wildcard .bbappend files with anonymous methods in them, bitbake/python fails to parse the generated code since the '%' is encoded in the generated method name. Fix this by including '%' in the convert-to-underscore list during method name mangling. While we're at it, move the method name mangling translation table to a class variable, as suggested by Chris Larson. [YOCTO #5864] (Bitbake rev: 537f1f9bbe110acc9848ef95f43468c07d87af79) Signed-off-by: Jacob Kroon <jacob.kroon@mikrodidakt.se> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--bitbake/lib/bb/parse/ast.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index a2020532ea..d8c141b37c 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -139,6 +139,8 @@ class DataNode(AstNode):
data.setVar(key, val, **loginfo)
class MethodNode(AstNode):
+ tr_tbl = string.maketrans('/.+-@%', '______')
+
def __init__(self, filename, lineno, func_name, body):
AstNode.__init__(self, filename, lineno)
self.func_name = func_name
@@ -147,7 +149,7 @@ class MethodNode(AstNode):
def eval(self, data):
text = '\n'.join(self.body)
if self.func_name == "__anonymous":
- funcname = ("__anon_%s_%s" % (self.lineno, self.filename.translate(string.maketrans('/.+-@', '_____'))))
+ funcname = ("__anon_%s_%s" % (self.lineno, self.filename.translate(MethodNode.tr_tbl)))
text = "def %s(d):\n" % (funcname) + text
bb.methodpool.insert_method(funcname, text, self.filename)
anonfuncs = data.getVar('__BBANONFUNCS') or []