Patchwork [bitbake-devel,1/2] bitbake: python funcname can not include special character @

login
register
mail settings
Submitter Li Wang
Date June 25, 2013, 6:31 a.m.
Message ID <1372141875-17591-1-git-send-email-li.wang@windriver.com>
Download mbox | patch
Permalink /patch/52313/
State New
Headers show

Comments

Li Wang - June 25, 2013, 6:31 a.m.
[YOCTO #4772]

When path:file change to python function, it maybe include '@' character.
So, add the special character to change to '_' for avoid error.

Signed-off-by: Li Wang <li.wang@windriver.com>
---
 bitbake/lib/bb/parse/ast.py |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index 6e7fd84..d4b8b09 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -147,7 +147,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(string.maketrans('/.+-@', '_____'))))
             text = "def %s(d):\n" % (funcname) + text
             bb.methodpool.insert_method(funcname, text, self.filename)
             anonfuncs = data.getVar('__BBANONFUNCS') or []