diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2010-08-26 18:06:30 +0100 |
---|---|---|
committer | Chris Larson <chris_larson@mentor.com> | 2010-12-30 08:47:43 -0700 |
commit | bbfaf3e1d87543187ffb0122e7474986feff3338 (patch) | |
tree | ad78e534c7e6f01a58f3383e2bcb32400863790c /lib/bb/parse/ast.py | |
parent | 64d945b2b66ae6f71b7aebd713f1be047bd22bbe (diff) | |
download | bitbake-bbfaf3e1d87543187ffb0122e7474986feff3338.tar.gz |
parse: save python functions into the metadata
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'lib/bb/parse/ast.py')
-rw-r--r-- | lib/bb/parse/ast.py | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/bb/parse/ast.py b/lib/bb/parse/ast.py index c001f1b45..55ab48599 100644 --- a/lib/bb/parse/ast.py +++ b/lib/bb/parse/ast.py @@ -141,7 +141,8 @@ class MethodNode: bb.data.setVar(self.func_name, '\n'.join(self.body), data) class PythonMethodNode(AstNode): - def __init__(self, root, body, fn): + def __init__(self, funcname, root, body, fn): + self.func_name = funcname self.root = root self.body = body self.fn = fn @@ -150,9 +151,12 @@ class PythonMethodNode(AstNode): # Note we will add root to parsedmethods after having parse # 'this' file. This means we will not parse methods from # bb classes twice + text = '\n'.join(self.body) if not bb.methodpool.parsed_module(self.root): - text = '\n'.join(self.body) bb.methodpool.insert_method(self.root, text, self.fn) + bb.data.setVarFlag(self.func_name, "func", 1, data) + bb.data.setVarFlag(self.func_name, "python", 1, data) + bb.data.setVar(self.func_name, text, data) class MethodFlagsNode(AstNode): def __init__(self, key, m): @@ -274,8 +278,8 @@ def handleData(statements, groupd): def handleMethod(statements, func_name, lineno, fn, body): statements.append(MethodNode(func_name, body, lineno, fn)) -def handlePythonMethod(statements, root, body, fn): - statements.append(PythonMethodNode(root, body, fn)) +def handlePythonMethod(statements, funcname, root, body, fn): + statements.append(PythonMethodNode(funcname, root, body, fn)) def handleMethodFlags(statements, key, m): statements.append(MethodFlagsNode(key, m)) |