summaryrefslogtreecommitdiff
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
parent169e719456e2ab461814e1620e949ef9f6d69e92 (diff)
downloadopenembedded-core-e3c9a340dc95092a400778d3a461045b146ec812.tar.gz
openembedded-core-e3c9a340dc95092a400778d3a461045b146ec812.tar.bz2
openembedded-core-e3c9a340dc95092a400778d3a461045b146ec812.zip
bitbake: [parser] Move more stuff out to separate methods...
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-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):
data.setVarFlag(func_name, "func", 1, d)
data.setVar(func_name, '\n'.join(body), d)
+def handlePythonMethod(root, body, fn):
+ # Note we will add root to parsedmethods after having parse
+ # 'this' file. This means we will not parse methods from
+ # bb classes twice
+ if not root in __parsed_methods__:
+ text = '\n'.join(body)
+ methodpool.insert_method(root, text, fn)
+
+def handleMethodFlags(key, m, d):
+ if data.getVar(key, d):
+ # Clean up old version of this piece of metadata, as its
+ # flags could cause problems
+ data.setVarFlag(key, 'python', None, d)
+ data.setVarFlag(key, 'fakeroot', None, d)
+ if m.group("py") is not None:
+ data.setVarFlag(key, "python", "1", d)
+ else:
+ data.delVarFlag(key, "python", d)
+ if m.group("fr") is not None:
+ data.setVarFlag(key, "fakeroot", "1", d)
+ else:
+ data.delVarFlag(key, "fakeroot", d)
+
def supports(fn, d):
return fn[-3:] == ".bb" or fn[-8:] == ".bbclass" or fn[-4:] == ".inc"
@@ -231,12 +254,7 @@ def feeder(lineno, s, fn, root, d):
__body__.append(s)
return
else:
- # Note we will add root to parsedmethods after having parse
- # 'this' file. This means we will not parse methods from
- # bb classes twice
- if not root in __parsed_methods__:
- text = '\n'.join(__body__)
- methodpool.insert_method( root, text, fn )
+ handlePythonMethod(root, __body__, fn)
__body__ = []
__inpython__ = False
@@ -257,20 +275,7 @@ def feeder(lineno, s, fn, root, d):
m = __func_start_regexp__.match(s)
if m:
__infunc__ = m.group("func") or "__anonymous"
- key = __infunc__
- if data.getVar(key, d):
-# clean up old version of this piece of metadata, as its
-# flags could cause problems
- data.setVarFlag(key, 'python', None, d)
- data.setVarFlag(key, 'fakeroot', None, d)
- if m.group("py") is not None:
- data.setVarFlag(key, "python", "1", d)
- else:
- data.delVarFlag(key, "python", d)
- if m.group("fr") is not None:
- data.setVarFlag(key, "fakeroot", "1", d)
- else:
- data.delVarFlag(key, "fakeroot", d)
+ handleMethodFlags(__infunc__, m, d)
return
m = __def_regexp__.match(s)