summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/parse/ast.py10
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py5
2 files changed, 10 insertions, 5 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index eb24e0ddd4..8763362cdf 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -137,7 +137,8 @@ class MethodNode:
137 bb.data.setVar(self.func_name, '\n'.join(self.body), data) 137 bb.data.setVar(self.func_name, '\n'.join(self.body), data)
138 138
139class PythonMethodNode(AstNode): 139class PythonMethodNode(AstNode):
140 def __init__(self, root, body, fn): 140 def __init__(self, funcname, root, body, fn):
141 self.func_name = funcname
141 self.root = root 142 self.root = root
142 self.body = body 143 self.body = body
143 self.fn = fn 144 self.fn = fn
@@ -149,6 +150,9 @@ class PythonMethodNode(AstNode):
149 if not bb.methodpool.parsed_module(self.root): 150 if not bb.methodpool.parsed_module(self.root):
150 text = '\n'.join(self.body) 151 text = '\n'.join(self.body)
151 bb.methodpool.insert_method(self.root, text, self.fn) 152 bb.methodpool.insert_method(self.root, text, self.fn)
153 bb.data.setVarFlag(self.func_name, "func", 1, data)
154 bb.data.setVarFlag(self.func_name, "python", 1, data)
155 bb.data.setVar(self.func_name, text, data)
152 156
153class MethodFlagsNode(AstNode): 157class MethodFlagsNode(AstNode):
154 def __init__(self, key, m): 158 def __init__(self, key, m):
@@ -270,8 +274,8 @@ def handleData(statements, groupd):
270def handleMethod(statements, func_name, lineno, fn, body): 274def handleMethod(statements, func_name, lineno, fn, body):
271 statements.append(MethodNode(func_name, body, lineno, fn)) 275 statements.append(MethodNode(func_name, body, lineno, fn))
272 276
273def handlePythonMethod(statements, root, body, fn): 277def handlePythonMethod(statements, funcname, root, body, fn):
274 statements.append(PythonMethodNode(root, body, fn)) 278 statements.append(PythonMethodNode(funcname, root, body, fn))
275 279
276def handleMethodFlags(statements, key, m): 280def handleMethodFlags(statements, key, m):
277 statements.append(MethodFlagsNode(key, m)) 281 statements.append(MethodFlagsNode(key, m))
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index bb56174881..51ad10fb92 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -183,7 +183,7 @@ def feeder(lineno, s, fn, root, statements):
183 __body__.append(s) 183 __body__.append(s)
184 return 184 return
185 else: 185 else:
186 ast.handlePythonMethod(statements, root, __body__, fn) 186 ast.handlePythonMethod(statements, __inpython__, root, __body__, fn)
187 __body__ = [] 187 __body__ = []
188 __inpython__ = False 188 __inpython__ = False
189 189
@@ -210,7 +210,8 @@ def feeder(lineno, s, fn, root, statements):
210 m = __def_regexp__.match(s) 210 m = __def_regexp__.match(s)
211 if m: 211 if m:
212 __body__.append(s) 212 __body__.append(s)
213 __inpython__ = True 213 __inpython__ = m.group(1)
214
214 return 215 return
215 216
216 m = __export_func_regexp__.match(s) 217 m = __export_func_regexp__.match(s)