summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/codeparser.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/bitbake/lib/bb/codeparser.py b/bitbake/lib/bb/codeparser.py
index 3ee4d5622b..2980510d41 100644
--- a/bitbake/lib/bb/codeparser.py
+++ b/bitbake/lib/bb/codeparser.py
@@ -191,6 +191,7 @@ class BufferedLogger(Logger):
191 191
192class PythonParser(): 192class PythonParser():
193 getvars = (".getVar", ".appendVar", ".prependVar") 193 getvars = (".getVar", ".appendVar", ".prependVar")
194 getvarflags = (".getVarFlag", ".appendVarFlag", ".prependVarFlag")
194 containsfuncs = ("bb.utils.contains", "base_contains", "bb.utils.contains_any") 195 containsfuncs = ("bb.utils.contains", "base_contains", "bb.utils.contains_any")
195 execfuncs = ("bb.build.exec_func", "bb.build.exec_task") 196 execfuncs = ("bb.build.exec_func", "bb.build.exec_task")
196 197
@@ -210,15 +211,20 @@ class PythonParser():
210 211
211 def visit_Call(self, node): 212 def visit_Call(self, node):
212 name = self.called_node_name(node.func) 213 name = self.called_node_name(node.func)
213 if name and name.endswith(self.getvars) or name in self.containsfuncs: 214 if name and (name.endswith(self.getvars) or name.endswith(self.getvarflags) or name in self.containsfuncs):
214 if isinstance(node.args[0], ast.Str): 215 if isinstance(node.args[0], ast.Str):
215 varname = node.args[0].s 216 varname = node.args[0].s
216 if name in self.containsfuncs and isinstance(node.args[1], ast.Str): 217 if name in self.containsfuncs and isinstance(node.args[1], ast.Str):
217 if varname not in self.contains: 218 if varname not in self.contains:
218 self.contains[varname] = set() 219 self.contains[varname] = set()
219 self.contains[varname].add(node.args[1].s) 220 self.contains[varname].add(node.args[1].s)
220 else: 221 elif name.endswith(self.getvarflags):
221 self.references.add(node.args[0].s) 222 if isinstance(node.args[1], ast.Str):
223 self.references.add('%s[%s]' % (varname, node.args[1].s))
224 else:
225 self.warn(node.func, node.args[1])
226 else:
227 self.references.add(varname)
222 else: 228 else:
223 self.warn(node.func, node.args[0]) 229 self.warn(node.func, node.args[0])
224 elif name and name.endswith(".expand"): 230 elif name and name.endswith(".expand"):