summaryrefslogtreecommitdiffstats
path: root/lib/bb/codeparser.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-02 13:54:01 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-02-04 23:47:43 +0000
commitb12c17be5e4a74c9680876605c87f46501f78d28 (patch)
tree4d62c2c72a7625d8b0ffa8771c78f98e064f96da /lib/bb/codeparser.py
parent7c3b99c6a716095af3ffce0b15110e91fb49c913 (diff)
downloadopenembedded-core-contrib-b12c17be5e4a74c9680876605c87f46501f78d28.tar.gz
codeparser: Improve handling of data.expand() dependencies
Currently bitbake doesn't parse into data.expand() expressions, relying on high level expansion of python code to handle this. One of the tests does however test this works. We don't really want to be doing string expansion on python code, so specifically parse into expand() function calls so that when the high level behaviour is tweaked, the self tests continue to pass and that we do continue to handle expand() function calls as best we can. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/codeparser.py')
-rw-r--r--lib/bb/codeparser.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/bb/codeparser.py b/lib/bb/codeparser.py
index 577b4271cf..2094f1337c 100644
--- a/lib/bb/codeparser.py
+++ b/lib/bb/codeparser.py
@@ -221,6 +221,17 @@ class PythonParser():
self.references.add(node.args[0].s)
else:
self.warn(node.func, node.args[0])
+ elif name and name.endswith(".expand"):
+ if isinstance(node.args[0], ast.Str):
+ value = node.args[0].s
+ d = bb.data.init()
+ parser = d.expandWithRefs(value, self.name)
+ self.references |= parser.references
+ self.execs |= parser.execs
+ for varname in parser.contains:
+ if varname not in self.contains:
+ self.contains[varname] = set()
+ self.contains[varname] |= parser.contains[varname]
elif name in self.execfuncs:
if isinstance(node.args[0], ast.Str):
self.var_execs.add(node.args[0].s)
@@ -243,6 +254,7 @@ class PythonParser():
break
def __init__(self, name, log):
+ self.name = name
self.var_execs = set()
self.contains = {}
self.execs = set()