summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/parse/parse_py/BBHandler.py
diff options
context:
space:
mode:
authorHolger Freyther <ich@tamarin.(none)>2009-05-18 19:24:07 +0200
committerRichard Purdie <rpurdie@linux.intel.com>2010-02-15 17:06:50 +0000
commit4b25b519ae46b283988a1847e56a19b01269b3a4 (patch)
tree00392d149975e64e1c685f7621844b2cc00a8792 /bitbake/lib/bb/parse/parse_py/BBHandler.py
parent5bac3403d7e51f72ee16c8123c2c8607a1d93ca9 (diff)
downloadpoky-4b25b519ae46b283988a1847e56a19b01269b3a4.tar.gz
bitbake: [parser] Cary a Statement Node through the parsing
When parsing we will collect a number of statements that can be evaluated...The plan is to be evaluate things twice (old+new) and then compare the result, it should be the same. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/parse/parse_py/BBHandler.py')
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py31
1 files changed, 16 insertions, 15 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index 1343ec114f..46413c5dc3 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -59,7 +59,7 @@ IN_PYTHON_EOF = -9999999999999
59def supports(fn, d): 59def supports(fn, d):
60 return fn[-3:] == ".bb" or fn[-8:] == ".bbclass" or fn[-4:] == ".inc" 60 return fn[-3:] == ".bb" or fn[-8:] == ".bbclass" or fn[-4:] == ".inc"
61 61
62def inherit(files, d): 62def inherit(statements, files, d):
63 __inherit_cache = data.getVar('__inherit_cache', d) or [] 63 __inherit_cache = data.getVar('__inherit_cache', d) or []
64 fn = "" 64 fn = ""
65 lineno = 0 65 lineno = 0
@@ -72,7 +72,7 @@ def inherit(files, d):
72 bb.msg.debug(2, bb.msg.domain.Parsing, "BB %s:%d: inheriting %s" % (fn, lineno, file)) 72 bb.msg.debug(2, bb.msg.domain.Parsing, "BB %s:%d: inheriting %s" % (fn, lineno, file))
73 __inherit_cache.append( file ) 73 __inherit_cache.append( file )
74 data.setVar('__inherit_cache', __inherit_cache, d) 74 data.setVar('__inherit_cache', __inherit_cache, d)
75 include(fn, file, d, "inherit") 75 include(statements, fn, file, d, "inherit")
76 __inherit_cache = data.getVar('__inherit_cache', d) or [] 76 __inherit_cache = data.getVar('__inherit_cache', d) or []
77 77
78 78
@@ -116,13 +116,14 @@ def finalise(fn, d):
116 bb.event.fire(bb.event.RecipeParsed(fn), d) 116 bb.event.fire(bb.event.RecipeParsed(fn), d)
117 117
118 118
119def handle(fn, d, include = 0): 119def handle(fn, d, include, statements):
120 global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__ 120 global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__
121 __body__ = [] 121 __body__ = []
122 __infunc__ = "" 122 __infunc__ = ""
123 __classname__ = "" 123 __classname__ = ""
124 __residue__ = [] 124 __residue__ = []
125 125
126
126 if include == 0: 127 if include == 0:
127 bb.msg.debug(2, bb.msg.domain.Parsing, "BB " + fn + ": handle(data)") 128 bb.msg.debug(2, bb.msg.domain.Parsing, "BB " + fn + ": handle(data)")
128 else: 129 else:
@@ -159,10 +160,10 @@ def handle(fn, d, include = 0):
159 s = f.readline() 160 s = f.readline()
160 if not s: break 161 if not s: break
161 s = s.rstrip() 162 s = s.rstrip()
162 feeder(lineno, s, fn, base_name, d) 163 feeder(lineno, s, fn, base_name, d, statements)
163 if __inpython__: 164 if __inpython__:
164 # add a blank line to close out any python definition 165 # add a blank line to close out any python definition
165 feeder(IN_PYTHON_EOF, "", fn, base_name, d) 166 feeder(IN_PYTHON_EOF, "", fn, base_name, d, statements)
166 if ext == ".bbclass": 167 if ext == ".bbclass":
167 classes.remove(__classname__) 168 classes.remove(__classname__)
168 else: 169 else:
@@ -182,7 +183,7 @@ def handle(fn, d, include = 0):
182 pn = data.getVar('PN', d, True) 183 pn = data.getVar('PN', d, True)
183 based = bb.data.createCopy(d) 184 based = bb.data.createCopy(d)
184 data.setVar('PN', pn + '-' + cls, based) 185 data.setVar('PN', pn + '-' + cls, based)
185 inherit([cls], based) 186 inherit(statements, [cls], based)
186 try: 187 try:
187 finalise(fn, based) 188 finalise(fn, based)
188 except bb.parse.SkipPackage: 189 except bb.parse.SkipPackage:
@@ -199,12 +200,12 @@ def handle(fn, d, include = 0):
199 200
200 return d 201 return d
201 202
202def feeder(lineno, s, fn, root, d): 203def feeder(lineno, s, fn, root, d, statements):
203 global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__,__infunc__, __body__, classes, bb, __residue__ 204 global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__,__infunc__, __body__, classes, bb, __residue__
204 if __infunc__: 205 if __infunc__:
205 if s == '}': 206 if s == '}':
206 __body__.append('') 207 __body__.append('')
207 ast.handleMethod(__infunc__, __body__, d) 208 ast.handleMethod(statements, __infunc__, lineno, fn, __body__, d)
208 __infunc__ = "" 209 __infunc__ = ""
209 __body__ = [] 210 __body__ = []
210 else: 211 else:
@@ -217,7 +218,7 @@ def feeder(lineno, s, fn, root, d):
217 __body__.append(s) 218 __body__.append(s)
218 return 219 return
219 else: 220 else:
220 ast.handlePythonMethod(root, __body__, fn) 221 ast.handlePythonMethod(statements, root, __body__, fn)
221 __body__ = [] 222 __body__ = []
222 __inpython__ = False 223 __inpython__ = False
223 224
@@ -238,7 +239,7 @@ def feeder(lineno, s, fn, root, d):
238 m = __func_start_regexp__.match(s) 239 m = __func_start_regexp__.match(s)
239 if m: 240 if m:
240 __infunc__ = m.group("func") or "__anonymous" 241 __infunc__ = m.group("func") or "__anonymous"
241 ast.handleMethodFlags(__infunc__, m, d) 242 ast.handleMethodFlags(statements, __infunc__, m, d)
242 return 243 return
243 244
244 m = __def_regexp__.match(s) 245 m = __def_regexp__.match(s)
@@ -249,26 +250,26 @@ def feeder(lineno, s, fn, root, d):
249 250
250 m = __export_func_regexp__.match(s) 251 m = __export_func_regexp__.match(s)
251 if m: 252 if m:
252 ast.handleExportFuncs(m, classes, d) 253 ast.handleExportFuncs(statements, m, classes, d)
253 return 254 return
254 255
255 m = __addtask_regexp__.match(s) 256 m = __addtask_regexp__.match(s)
256 if m: 257 if m:
257 ast.handleAddTask(m, d ) 258 ast.handleAddTask(statements, m, d)
258 return 259 return
259 260
260 m = __addhandler_regexp__.match(s) 261 m = __addhandler_regexp__.match(s)
261 if m: 262 if m:
262 ast.handleBBHandlers(m, d) 263 ast.handleBBHandlers(statements, m, d)
263 return 264 return
264 265
265 m = __inherit_regexp__.match(s) 266 m = __inherit_regexp__.match(s)
266 if m: 267 if m:
267 ast.handleInherit(m, d) 268 ast.handleInherit(statements, m, d)
268 return 269 return
269 270
270 from bb.parse import ConfHandler 271 from bb.parse import ConfHandler
271 return ConfHandler.feeder(lineno, s, fn, d) 272 return ConfHandler.feeder(lineno, s, fn, d, statements)
272 273
273__pkgsplit_cache__={} 274__pkgsplit_cache__={}
274def vars_from_file(mypkg, d): 275def vars_from_file(mypkg, d):