summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/parse/ast.py
diff options
context:
space:
mode:
authorHolger Freyther <ich@tamarin.(none)>2009-05-19 10:10:26 +0200
committerRichard Purdie <rpurdie@linux.intel.com>2010-02-15 17:07:47 +0000
commitd84b7c555512288b916ebc58b4baeefb9758d6bf (patch)
treec338f1a31dc1c1e99ef1418c927079544294d41e /bitbake/lib/bb/parse/ast.py
parenta5bb5d625edfe3f23970f38165ef15ad7167efa4 (diff)
downloadpoky-d84b7c555512288b916ebc58b4baeefb9758d6bf.tar.gz
bitbake: [parser] Move one more item to the ast
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/parse/ast.py')
-rw-r--r--bitbake/lib/bb/parse/ast.py75
1 files changed, 41 insertions, 34 deletions
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index 8296fd0a79..cdc736a62a 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -170,6 +170,45 @@ class MethodFlagsNode:
170 else: 170 else:
171 bb.data.delVarFlag(self.key, "fakeroot", data) 171 bb.data.delVarFlag(self.key, "fakeroot", data)
172 172
173class ExportFuncsNode:
174 def __init__(self, fns, classes):
175 self.n = __word__.findall(fns)
176 self.classes = classes
177
178 def eval(self, data):
179 for f in self.n:
180 allvars = []
181 allvars.append(f)
182 allvars.append(self.classes[-1] + "_" + f)
183
184 vars = [[ allvars[0], allvars[1] ]]
185 if len(self.classes) > 1 and self.classes[-2] is not None:
186 allvars.append(self.classes[-2] + "_" + f)
187 vars = []
188 vars.append([allvars[2], allvars[1]])
189 vars.append([allvars[0], allvars[2]])
190
191 for (var, calledvar) in vars:
192 if bb.data.getVar(var, data) and not bb.data.getVarFlag(var, 'export_func', data):
193 continue
194
195 if bb.data.getVar(var, data):
196 bb.data.setVarFlag(var, 'python', None, data)
197 bb.data.setVarFlag(var, 'func', None, data)
198
199 for flag in [ "func", "python" ]:
200 if bb.data.getVarFlag(calledvar, flag, data):
201 bb.data.setVarFlag(var, flag, bb.data.getVarFlag(calledvar, flag, data), data)
202 for flag in [ "dirs" ]:
203 if bb.data.getVarFlag(var, flag, data):
204 bb.data.setVarFlag(calledvar, flag, bb.data.getVarFlag(var, flag, data), data)
205
206 if bb.data.getVarFlag(calledvar, "python", data):
207 bb.data.setVar(var, "\tbb.build.exec_func('" + calledvar + "', d)\n", data)
208 else:
209 bb.data.setVar(var, "\t" + calledvar + "\n", data)
210 bb.data.setVarFlag(var, 'export_func', '1', data)
211
173def handleInclude(statements, m, fn, lineno, data, force): 212def handleInclude(statements, m, fn, lineno, data, force):
174 # AST handling 213 # AST handling
175 statements.append(IncludeNode(m.group(1), fn, lineno, force)) 214 statements.append(IncludeNode(m.group(1), fn, lineno, force))
@@ -200,40 +239,8 @@ def handleMethodFlags(statements, key, m, d):
200 statements[-1].eval(d) 239 statements[-1].eval(d)
201 240
202def handleExportFuncs(statements, m, classes, d): 241def handleExportFuncs(statements, m, classes, d):
203 fns = m.group(1) 242 statements.append(ExportFuncsNode(m.group(1), classes))
204 n = __word__.findall(fns) 243 statements[-1].eval(d)
205 for f in n:
206 allvars = []
207 allvars.append(f)
208 allvars.append(classes[-1] + "_" + f)
209
210 vars = [[ allvars[0], allvars[1] ]]
211 if len(classes) > 1 and classes[-2] is not None:
212 allvars.append(classes[-2] + "_" + f)
213 vars = []
214 vars.append([allvars[2], allvars[1]])
215 vars.append([allvars[0], allvars[2]])
216
217 for (var, calledvar) in vars:
218 if bb.data.getVar(var, d) and not bb.data.getVarFlag(var, 'export_func', d):
219 continue
220
221 if bb.data.getVar(var, d):
222 bb.data.setVarFlag(var, 'python', None, d)
223 bb.data.setVarFlag(var, 'func', None, d)
224
225 for flag in [ "func", "python" ]:
226 if bb.data.getVarFlag(calledvar, flag, d):
227 bb.data.setVarFlag(var, flag, bb.data.getVarFlag(calledvar, flag, d), d)
228 for flag in [ "dirs" ]:
229 if bb.data.getVarFlag(var, flag, d):
230 bb.data.setVarFlag(calledvar, flag, bb.data.getVarFlag(var, flag, d), d)
231
232 if bb.data.getVarFlag(calledvar, "python", d):
233 bb.data.setVar(var, "\tbb.build.exec_func('" + calledvar + "', d)\n", d)
234 else:
235 bb.data.setVar(var, "\t" + calledvar + "\n", d)
236 bb.data.setVarFlag(var, 'export_func', '1', d)
237 244
238def handleAddTask(statements, m, d): 245def handleAddTask(statements, m, d):
239 func = m.group("func") 246 func = m.group("func")