diff options
| -rw-r--r-- | bitbake/lib/bb/parse/parse_py/BBHandler.py | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index ec097baf73..97a9ee8dac 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py | |||
| @@ -47,7 +47,6 @@ __addhandler_regexp__ = re.compile( r"addhandler\s+(.+)" ) | |||
| 47 | __def_regexp__ = re.compile( r"def\s+(\w+).*:" ) | 47 | __def_regexp__ = re.compile( r"def\s+(\w+).*:" ) |
| 48 | __python_func_regexp__ = re.compile( r"(\s+.*)|(^$)" ) | 48 | __python_func_regexp__ = re.compile( r"(\s+.*)|(^$)" ) |
| 49 | 49 | ||
| 50 | |||
| 51 | __infunc__ = [] | 50 | __infunc__ = [] |
| 52 | __inpython__ = False | 51 | __inpython__ = False |
| 53 | __body__ = [] | 52 | __body__ = [] |
| @@ -55,15 +54,6 @@ __classname__ = "" | |||
| 55 | 54 | ||
| 56 | cached_statements = {} | 55 | cached_statements = {} |
| 57 | 56 | ||
| 58 | # We need to indicate EOF to the feeder. This code is so messy that | ||
| 59 | # factoring it out to a close_parse_file method is out of question. | ||
| 60 | # We will use the IN_PYTHON_EOF as an indicator to just close the method | ||
| 61 | # | ||
| 62 | # The two parts using it are tightly integrated anyway | ||
| 63 | IN_PYTHON_EOF = -9999999999999 | ||
| 64 | |||
| 65 | |||
| 66 | |||
| 67 | def supports(fn, d): | 57 | def supports(fn, d): |
| 68 | """Return True if fn has a supported extension""" | 58 | """Return True if fn has a supported extension""" |
| 69 | return os.path.splitext(fn)[-1] in [".bb", ".bbclass", ".inc"] | 59 | return os.path.splitext(fn)[-1] in [".bb", ".bbclass", ".inc"] |
| @@ -110,7 +100,7 @@ def get_statements(filename, absolute_filename, base_name): | |||
| 110 | file.close() | 100 | file.close() |
| 111 | if __inpython__: | 101 | if __inpython__: |
| 112 | # add a blank line to close out any python definition | 102 | # add a blank line to close out any python definition |
| 113 | feeder(IN_PYTHON_EOF, "", filename, base_name, statements) | 103 | feeder(lineno, "", filename, base_name, statements, eof=True) |
| 114 | 104 | ||
| 115 | if filename.endswith(".bbclass") or filename.endswith(".inc"): | 105 | if filename.endswith(".bbclass") or filename.endswith(".inc"): |
| 116 | cached_statements[absolute_filename] = statements | 106 | cached_statements[absolute_filename] = statements |
| @@ -171,7 +161,7 @@ def handle(fn, d, include): | |||
| 171 | 161 | ||
| 172 | return d | 162 | return d |
| 173 | 163 | ||
| 174 | def feeder(lineno, s, fn, root, statements): | 164 | def feeder(lineno, s, fn, root, statements, eof=False): |
| 175 | global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__, __infunc__, __body__, bb, __residue__, __classname__ | 165 | global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__, __infunc__, __body__, bb, __residue__, __classname__ |
| 176 | if __infunc__: | 166 | if __infunc__: |
| 177 | if s == '}': | 167 | if s == '}': |
| @@ -185,7 +175,7 @@ def feeder(lineno, s, fn, root, statements): | |||
| 185 | 175 | ||
| 186 | if __inpython__: | 176 | if __inpython__: |
| 187 | m = __python_func_regexp__.match(s) | 177 | m = __python_func_regexp__.match(s) |
| 188 | if m and lineno != IN_PYTHON_EOF: | 178 | if m and not eof: |
| 189 | __body__.append(s) | 179 | __body__.append(s) |
| 190 | return | 180 | return |
| 191 | else: | 181 | else: |
| @@ -194,7 +184,7 @@ def feeder(lineno, s, fn, root, statements): | |||
| 194 | __body__ = [] | 184 | __body__ = [] |
| 195 | __inpython__ = False | 185 | __inpython__ = False |
| 196 | 186 | ||
| 197 | if lineno == IN_PYTHON_EOF: | 187 | if eof: |
| 198 | return | 188 | return |
| 199 | 189 | ||
| 200 | if s and s[0] == '#': | 190 | if s and s[0] == '#': |
