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.py35
1 files changed, 13 insertions, 22 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index 646a5b8d8e..e0b795fa68 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -26,23 +26,14 @@ import bb, re, string
26__word__ = re.compile(r"\S+") 26__word__ = re.compile(r"\S+")
27__parsed_methods__ = bb.methodpool.get_parsed_dict() 27__parsed_methods__ = bb.methodpool.get_parsed_dict()
28 28
29class StatementGroup: 29class StatementGroup(list):
30 def __init__(self):
31 self.statements = []
32
33 def append(self, statement):
34 self.statements.append(statement)
35
36 def eval(self, data): 30 def eval(self, data):
37 """ 31 map(lambda x: x.eval(data), self)
38 Apply each statement on the data... in order
39 """
40 map(lambda x: x.eval(data), self.statements)
41 32
42 def __getitem__(self, item): 33class AstNode(object):
43 return self.statements.__getitem__(item) 34 pass
44 35
45class IncludeNode: 36class IncludeNode(AstNode):
46 def __init__(self, what_file, fn, lineno, force): 37 def __init__(self, what_file, fn, lineno, force):
47 self.what_file = what_file 38 self.what_file = what_file
48 self.from_fn = fn 39 self.from_fn = fn
@@ -62,14 +53,14 @@ class IncludeNode:
62 else: 53 else:
63 bb.parse.ConfHandler.include(self.from_fn, s, data, False) 54 bb.parse.ConfHandler.include(self.from_fn, s, data, False)
64 55
65class ExportNode: 56class ExportNode(AstNode):
66 def __init__(self, var): 57 def __init__(self, var):
67 self.var = var 58 self.var = var
68 59
69 def eval(self, data): 60 def eval(self, data):
70 bb.data.setVarFlag(self.var, "export", 1, data) 61 bb.data.setVarFlag(self.var, "export", 1, data)
71 62
72class DataNode: 63class DataNode(AstNode):
73 """ 64 """
74 Various data related updates. For the sake of sanity 65 Various data related updates. For the sake of sanity
75 we have one class doing all this. This means that all 66 we have one class doing all this. This means that all
@@ -134,7 +125,7 @@ class MethodNode:
134 bb.data.setVarFlag(self.func_name, "func", 1, data) 125 bb.data.setVarFlag(self.func_name, "func", 1, data)
135 bb.data.setVar(self.func_name, '\n'.join(self.body), data) 126 bb.data.setVar(self.func_name, '\n'.join(self.body), data)
136 127
137class PythonMethodNode: 128class PythonMethodNode(AstNode):
138 def __init__(self, root, body, fn): 129 def __init__(self, root, body, fn):
139 self.root = root 130 self.root = root
140 self.body = body 131 self.body = body
@@ -148,7 +139,7 @@ class PythonMethodNode:
148 text = '\n'.join(self.body) 139 text = '\n'.join(self.body)
149 bb.methodpool.insert_method(self.root, text, self.fn) 140 bb.methodpool.insert_method(self.root, text, self.fn)
150 141
151class MethodFlagsNode: 142class MethodFlagsNode(AstNode):
152 def __init__(self, key, m): 143 def __init__(self, key, m):
153 self.key = key 144 self.key = key
154 self.m = m 145 self.m = m
@@ -168,7 +159,7 @@ class MethodFlagsNode:
168 else: 159 else:
169 bb.data.delVarFlag(self.key, "fakeroot", data) 160 bb.data.delVarFlag(self.key, "fakeroot", data)
170 161
171class ExportFuncsNode: 162class ExportFuncsNode(AstNode):
172 def __init__(self, fns, classes): 163 def __init__(self, fns, classes):
173 self.n = __word__.findall(fns) 164 self.n = __word__.findall(fns)
174 self.classes = classes 165 self.classes = classes
@@ -207,7 +198,7 @@ class ExportFuncsNode:
207 bb.data.setVar(var, "\t" + calledvar + "\n", data) 198 bb.data.setVar(var, "\t" + calledvar + "\n", data)
208 bb.data.setVarFlag(var, 'export_func', '1', data) 199 bb.data.setVarFlag(var, 'export_func', '1', data)
209 200
210class AddTaskNode: 201class AddTaskNode(AstNode):
211 def __init__(self, func, before, after): 202 def __init__(self, func, before, after):
212 self.func = func 203 self.func = func
213 self.before = before 204 self.before = before
@@ -238,7 +229,7 @@ class AddTaskNode:
238 if var not in existing: 229 if var not in existing:
239 bb.data.setVarFlag(entry, "deps", [var] + existing, data) 230 bb.data.setVarFlag(entry, "deps", [var] + existing, data)
240 231
241class BBHandlerNode: 232class BBHandlerNode(AstNode):
242 def __init__(self, fns): 233 def __init__(self, fns):
243 self.hs = __word__.findall(fns) 234 self.hs = __word__.findall(fns)
244 235
@@ -249,7 +240,7 @@ class BBHandlerNode:
249 bb.data.setVarFlag(h, "handler", 1, data) 240 bb.data.setVarFlag(h, "handler", 1, data)
250 bb.data.setVar('__BBHANDLERS', bbhands, data) 241 bb.data.setVar('__BBHANDLERS', bbhands, data)
251 242
252class InheritNode: 243class InheritNode(AstNode):
253 def __init__(self, files): 244 def __init__(self, files):
254 self.n = __word__.findall(files) 245 self.n = __word__.findall(files)
255 246