summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/parse/ast.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/parse/ast.py')
-rw-r--r--bitbake/lib/bb/parse/ast.py38
1 files changed, 23 insertions, 15 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index 2a2fe1d519..8296fd0a79 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -149,8 +149,27 @@ class PythonMethodNode:
149 if not self.root in __parsed_methods__: 149 if not self.root in __parsed_methods__:
150 text = '\n'.join(self.body) 150 text = '\n'.join(self.body)
151 bb.methodpool.insert_method(self.root, text, self.fn) 151 bb.methodpool.insert_method(self.root, text, self.fn)
152 152
153 153class MethodFlagsNode:
154 def __init__(self, key, m):
155 self.key = key
156 self.m = m
157
158 def eval(self, data):
159 if bb.data.getVar(self.key, data):
160 # clean up old version of this piece of metadata, as its
161 # flags could cause problems
162 bb.data.setVarFlag(self.key, 'python', None, data)
163 bb.data.setVarFlag(self.key, 'fakeroot', None, data)
164 if self.m.group("py") is not None:
165 bb.data.setVarFlag(self.key, "python", "1", data)
166 else:
167 bb.data.delVarFlag(self.key, "python", data)
168 if self.m.group("fr") is not None:
169 bb.data.setVarFlag(self.key, "fakeroot", "1", data)
170 else:
171 bb.data.delVarFlag(self.key, "fakeroot", data)
172
154def handleInclude(statements, m, fn, lineno, data, force): 173def handleInclude(statements, m, fn, lineno, data, force):
155 # AST handling 174 # AST handling
156 statements.append(IncludeNode(m.group(1), fn, lineno, force)) 175 statements.append(IncludeNode(m.group(1), fn, lineno, force))
@@ -177,19 +196,8 @@ def handlePythonMethod(statements, root, body, fn):
177 statements[-1].eval(None) 196 statements[-1].eval(None)
178 197
179def handleMethodFlags(statements, key, m, d): 198def handleMethodFlags(statements, key, m, d):
180 if bb.data.getVar(key, d): 199 statements.append(MethodFlagsNode(key, m))
181 # Clean up old version of this piece of metadata, as its 200 statements[-1].eval(d)
182 # flags could cause problems
183 bb.data.setVarFlag(key, 'python', None, d)
184 bb.data.setVarFlag(key, 'fakeroot', None, d)
185 if m.group("py") is not None:
186 bb.data.setVarFlag(key, "python", "1", d)
187 else:
188 bb.data.delVarFlag(key, "python", d)
189 if m.group("fr") is not None:
190 bb.data.setVarFlag(key, "fakeroot", "1", d)
191 else:
192 bb.data.delVarFlag(key, "fakeroot", d)
193 201
194def handleExportFuncs(statements, m, classes, d): 202def handleExportFuncs(statements, m, classes, d):
195 fns = m.group(1) 203 fns = m.group(1)