summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorHolger Freyther <ich@tamarin.(none)>2009-05-19 10:52:18 +0200
committerRichard Purdie <rpurdie@linux.intel.com>2010-02-15 17:07:48 +0000
commitbaf239590070201bd24bb63d95158a58cf9dcaa6 (patch)
tree74faac88cd38925eb58a68bfb31b3c150e318962 /bitbake
parentd84b7c555512288b916ebc58b4baeefb9758d6bf (diff)
downloadpoky-baf239590070201bd24bb63d95158a58cf9dcaa6.tar.gz
bitbake: [parser] Move more methods to the ast scheme
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/parse/ast.py79
1 files changed, 48 insertions, 31 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index cdc736a62a..f5974f40d2 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -208,7 +208,49 @@ class ExportFuncsNode:
208 else: 208 else:
209 bb.data.setVar(var, "\t" + calledvar + "\n", data) 209 bb.data.setVar(var, "\t" + calledvar + "\n", data)
210 bb.data.setVarFlag(var, 'export_func', '1', data) 210 bb.data.setVarFlag(var, 'export_func', '1', data)
211 211
212class AddTaskNode:
213 def __init__(self, func, before, after):
214 self.func = func
215 self.before = before
216 self.after = after
217
218 def eval(self, data):
219 var = self.func
220 if self.func[:3] != "do_":
221 var = "do_" + self.func
222
223 bb.data.setVarFlag(var, "task", 1, data)
224 bbtasks = bb.data.getVar('__BBTASKS', data) or []
225 if not var in bbtasks:
226 bbtasks.append(var)
227 bb.data.setVar('__BBTASKS', bbtasks, data)
228
229 existing = bb.data.getVarFlag(var, "deps", data) or []
230 if self.after is not None:
231 # set up deps for function
232 for entry in self.after.split():
233 if entry not in existing:
234 existing.append(entry)
235 bb.data.setVarFlag(var, "deps", existing, data)
236 if self.before is not None:
237 # set up things that depend on this func
238 for entry in self.before.split():
239 existing = bb.data.getVarFlag(entry, "deps", data) or []
240 if var not in existing:
241 bb.data.setVarFlag(entry, "deps", [var] + existing, data)
242
243class BBHandlerNode:
244 def __init__(self, fns):
245 self.hs = __word__.findall(fns)
246
247 def eval(self, data):
248 bbhands = bb.data.getVar('__BBHANDLERS', data) or []
249 for h in self.hs:
250 bbhands.append(h)
251 bb.data.setVarFlag(h, "handler", 1, data)
252 bb.data.setVar('__BBHANDLERS', bbhands, data)
253
212def handleInclude(statements, m, fn, lineno, data, force): 254def handleInclude(statements, m, fn, lineno, data, force):
213 # AST handling 255 # AST handling
214 statements.append(IncludeNode(m.group(1), fn, lineno, force)) 256 statements.append(IncludeNode(m.group(1), fn, lineno, force))
@@ -248,38 +290,13 @@ def handleAddTask(statements, m, d):
248 after = m.group("after") 290 after = m.group("after")
249 if func is None: 291 if func is None:
250 return 292 return
251 if func[:3] != "do_": 293
252 var = "do_" + func 294 statements.append(AddTaskNode(func, before, after))
253 295 statements[-1].eval(d)
254 bb.data.setVarFlag(var, "task", 1, d)
255
256 bbtasks = bb.data.getVar('__BBTASKS', d) or []
257 if not var in bbtasks:
258 bbtasks.append(var)
259 bb.data.setVar('__BBTASKS', bbtasks, d)
260
261 existing = bb.data.getVarFlag(var, "deps", d) or []
262 if after is not None:
263 # set up deps for function
264 for entry in after.split():
265 if entry not in existing:
266 existing.append(entry)
267 bb.data.setVarFlag(var, "deps", existing, d)
268 if before is not None:
269 # set up things that depend on this func
270 for entry in before.split():
271 existing = bb.data.getVarFlag(entry, "deps", d) or []
272 if var not in existing:
273 bb.data.setVarFlag(entry, "deps", [var] + existing, d)
274 296
275def handleBBHandlers(statements, m, d): 297def handleBBHandlers(statements, m, d):
276 fns = m.group(1) 298 statements.append(BBHandlerNode(m.group(1)))
277 hs = __word__.findall(fns) 299 statements[-1].eval(d)
278 bbhands = bb.data.getVar('__BBHANDLERS', d) or []
279 for h in hs:
280 bbhands.append(h)
281 bb.data.setVarFlag(h, "handler", 1, d)
282 bb.data.setVar('__BBHANDLERS', bbhands, d)
283 300
284def handleInherit(statements, m, d): 301def handleInherit(statements, m, d):
285 files = m.group(1) 302 files = m.group(1)