summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHolger Freyther <ich@tamarin.(none)>2009-05-19 13:22:30 +0200
committerRichard Purdie <rpurdie@linux.intel.com>2010-02-15 17:07:53 +0000
commitc011d42eda4b830ec2a609817b61d166ff0413d4 (patch)
tree3fa500506d92c55b447d22673dbf630c3fcc3229
parent793c88dd92747890e910c598e19f1778865883d2 (diff)
downloadopenembedded-core-c011d42eda4b830ec2a609817b61d166ff0413d4.tar.gz
openembedded-core-c011d42eda4b830ec2a609817b61d166ff0413d4.tar.bz2
openembedded-core-c011d42eda4b830ec2a609817b61d166ff0413d4.zip
bitbake: [parser] prepare to cache some .bbcclass and .inc files
Our parser is shit but instead to replace it now we will see how long we can drive the wave by caching parsed files. This will not go through the feeder again but we can just reevaluate the StatementGroup. Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py29
1 files changed, 18 insertions, 11 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index f313009ab8..9b8ad0b9ec 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -78,6 +78,22 @@ def inherit(files, d):
include(fn, file, d, "inherit")
__inherit_cache = data.getVar('__inherit_cache', d) or []
+def get_statements(filename, absolsute_filename, base_name, file):
+ statements = ast.StatementGroup()
+
+ lineno = 0
+ while 1:
+ lineno = lineno + 1
+ s = file.readline()
+ if not s: break
+ s = s.rstrip()
+ feeder(lineno, s, filename, base_name, statements)
+ if __inpython__:
+ # add a blank line to close out any python definition
+ feeder(IN_PYTHON_EOF, "", filename, base_name, statements)
+
+ return statements
+
def handle(fn, d, include):
global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__
__body__ = []
@@ -113,17 +129,8 @@ def handle(fn, d, include):
if include:
bb.parse.mark_dependency(d, abs_fn)
- statements = ast.StatementGroup()
- lineno = 0
- while 1:
- lineno = lineno + 1
- s = f.readline()
- if not s: break
- s = s.rstrip()
- feeder(lineno, s, fn, base_name, statements)
- if __inpython__:
- # add a blank line to close out any python definition
- feeder(IN_PYTHON_EOF, "", fn, base_name, statements)
+ # actual loading
+ statements = get_statements(fn, abs_fn, base_name, f)
# DONE WITH PARSING... time to evaluate
if ext != ".bbclass":