summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/parse/parse_py
diff options
context:
space:
mode:
authorHolger Freyther <ich@tamarin.(none)>2009-05-17 12:42:43 +0200
committerRichard Purdie <rpurdie@linux.intel.com>2010-02-10 16:32:00 +0000
commite3c9a340dc95092a400778d3a461045b146ec812 (patch)
tree5db08546cf5fc0c5df4ad746c23bf8104a4206ee /bitbake/lib/bb/parse/parse_py
parent169e719456e2ab461814e1620e949ef9f6d69e92 (diff)
downloadpoky-e3c9a340dc95092a400778d3a461045b146ec812.tar.gz
bitbake: [parser] Move more stuff out to separate methods...
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/parse/parse_py')
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py45
1 files changed, 25 insertions, 20 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index 0ef9ef69c0..4580d5ee5b 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -70,6 +70,29 @@ def handleMethod(func_name, body, d):
70 data.setVarFlag(func_name, "func", 1, d) 70 data.setVarFlag(func_name, "func", 1, d)
71 data.setVar(func_name, '\n'.join(body), d) 71 data.setVar(func_name, '\n'.join(body), d)
72 72
73def handlePythonMethod(root, body, fn):
74 # Note we will add root to parsedmethods after having parse
75 # 'this' file. This means we will not parse methods from
76 # bb classes twice
77 if not root in __parsed_methods__:
78 text = '\n'.join(body)
79 methodpool.insert_method(root, text, fn)
80
81def handleMethodFlags(key, m, d):
82 if data.getVar(key, d):
83 # Clean up old version of this piece of metadata, as its
84 # flags could cause problems
85 data.setVarFlag(key, 'python', None, d)
86 data.setVarFlag(key, 'fakeroot', None, d)
87 if m.group("py") is not None:
88 data.setVarFlag(key, "python", "1", d)
89 else:
90 data.delVarFlag(key, "python", d)
91 if m.group("fr") is not None:
92 data.setVarFlag(key, "fakeroot", "1", d)
93 else:
94 data.delVarFlag(key, "fakeroot", d)
95
73def supports(fn, d): 96def supports(fn, d):
74 return fn[-3:] == ".bb" or fn[-8:] == ".bbclass" or fn[-4:] == ".inc" 97 return fn[-3:] == ".bb" or fn[-8:] == ".bbclass" or fn[-4:] == ".inc"
75 98
@@ -231,12 +254,7 @@ def feeder(lineno, s, fn, root, d):
231 __body__.append(s) 254 __body__.append(s)
232 return 255 return
233 else: 256 else:
234 # Note we will add root to parsedmethods after having parse 257 handlePythonMethod(root, __body__, fn)
235 # 'this' file. This means we will not parse methods from
236 # bb classes twice
237 if not root in __parsed_methods__:
238 text = '\n'.join(__body__)
239 methodpool.insert_method( root, text, fn )
240 __body__ = [] 258 __body__ = []
241 __inpython__ = False 259 __inpython__ = False
242 260
@@ -257,20 +275,7 @@ def feeder(lineno, s, fn, root, d):
257 m = __func_start_regexp__.match(s) 275 m = __func_start_regexp__.match(s)
258 if m: 276 if m:
259 __infunc__ = m.group("func") or "__anonymous" 277 __infunc__ = m.group("func") or "__anonymous"
260 key = __infunc__ 278 handleMethodFlags(__infunc__, m, d)
261 if data.getVar(key, d):
262# clean up old version of this piece of metadata, as its
263# flags could cause problems
264 data.setVarFlag(key, 'python', None, d)
265 data.setVarFlag(key, 'fakeroot', None, d)
266 if m.group("py") is not None:
267 data.setVarFlag(key, "python", "1", d)
268 else:
269 data.delVarFlag(key, "python", d)
270 if m.group("fr") is not None:
271 data.setVarFlag(key, "fakeroot", "1", d)
272 else:
273 data.delVarFlag(key, "fakeroot", d)
274 return 279 return
275 280
276 m = __def_regexp__.match(s) 281 m = __def_regexp__.match(s)