]> code.ossystems Code Review - openembedded-core.git/commitdiff
bitbake: [parser] prepare to cache some .bbcclass and .inc files
authorHolger Freyther <ich@tamarin.(none)>
Tue, 19 May 2009 11:22:30 +0000 (13:22 +0200)
committerRichard Purdie <rpurdie@linux.intel.com>
Mon, 15 Feb 2010 17:07:53 +0000 (17:07 +0000)
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>
bitbake/lib/bb/parse/parse_py/BBHandler.py

index f313009ab8979a11b0e2e303fb62aecaecf1f649..9b8ad0b9ec5b6094b3870d647984f67553cb32f4 100644 (file)
@@ -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":