summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py37
1 files changed, 23 insertions, 14 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index 9b8ad0b9ec..ab479c1eb2 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -50,6 +50,8 @@ __body__ = []
50__classname__ = "" 50__classname__ = ""
51classes = [ None, ] 51classes = [ None, ]
52 52
53cached_statements = {}
54
53# We need to indicate EOF to the feeder. This code is so messy that 55# We need to indicate EOF to the feeder. This code is so messy that
54# factoring it out to a close_parse_file method is out of question. 56# factoring it out to a close_parse_file method is out of question.
55# We will use the IN_PYTHON_EOF as an indicator to just close the method 57# We will use the IN_PYTHON_EOF as an indicator to just close the method
@@ -79,20 +81,27 @@ def inherit(files, d):
79 __inherit_cache = data.getVar('__inherit_cache', d) or [] 81 __inherit_cache = data.getVar('__inherit_cache', d) or []
80 82
81def get_statements(filename, absolsute_filename, base_name, file): 83def get_statements(filename, absolsute_filename, base_name, file):
82 statements = ast.StatementGroup() 84 global cached_statements
83 85
84 lineno = 0 86 try:
85 while 1: 87 return cached_statements[absolsute_filename]
86 lineno = lineno + 1 88 except KeyError:
87 s = file.readline() 89 statements = ast.StatementGroup()
88 if not s: break 90
89 s = s.rstrip() 91 lineno = 0
90 feeder(lineno, s, filename, base_name, statements) 92 while 1:
91 if __inpython__: 93 lineno = lineno + 1
92 # add a blank line to close out any python definition 94 s = file.readline()
93 feeder(IN_PYTHON_EOF, "", filename, base_name, statements) 95 if not s: break
94 96 s = s.rstrip()
95 return statements 97 feeder(lineno, s, filename, base_name, statements)
98 if __inpython__:
99 # add a blank line to close out any python definition
100 feeder(IN_PYTHON_EOF, "", filename, base_name, statements)
101
102 if filename.endswith(".bbclass") or filename.endswith(".inc"):
103 cached_statements[absolsute_filename] = statements
104 return statements
96 105
97def handle(fn, d, include): 106def handle(fn, d, include):
98 global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__ 107 global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __infunc__, __body__, __residue__