diff options
Diffstat (limited to 'bitbake/lib/bb/parse/parse_py/BBHandler.py')
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/BBHandler.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index 01fc47e512..f3bf4aa529 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py | |||
@@ -46,6 +46,7 @@ __deltask_regexp__ = re.compile("deltask\s+(?P<func>\w+)") | |||
46 | __addhandler_regexp__ = re.compile( r"addhandler\s+(.+)" ) | 46 | __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 | __python_tab_regexp__ = re.compile(" *\t") | ||
49 | 50 | ||
50 | __infunc__ = [] | 51 | __infunc__ = [] |
51 | __inpython__ = False | 52 | __inpython__ = False |
@@ -160,6 +161,16 @@ def handle(fn, d, include): | |||
160 | 161 | ||
161 | def feeder(lineno, s, fn, root, statements, eof=False): | 162 | def feeder(lineno, s, fn, root, statements, eof=False): |
162 | global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__, __infunc__, __body__, bb, __residue__, __classname__ | 163 | global __func_start_regexp__, __inherit_regexp__, __export_func_regexp__, __addtask_regexp__, __addhandler_regexp__, __def_regexp__, __python_func_regexp__, __inpython__, __infunc__, __body__, bb, __residue__, __classname__ |
164 | |||
165 | # Check tabs in python functions: | ||
166 | # - def py_funcname(): covered by __inpython__ | ||
167 | # - python(): covered by '__anonymous' == __infunc__[0] | ||
168 | # - python funcname(): covered by __infunc__[3] | ||
169 | if __inpython__ or (__infunc__ and ('__anonymous' == __infunc__[0] or __infunc__[3])): | ||
170 | tab = __python_tab_regexp__.match(s) | ||
171 | if tab: | ||
172 | bb.warn('python should use 4 spaces indentation, but found tabs in %s, line %s' % (root, lineno)) | ||
173 | |||
163 | if __infunc__: | 174 | if __infunc__: |
164 | if s == '}': | 175 | if s == '}': |
165 | __body__.append('') | 176 | __body__.append('') |