diff options
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/data.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/BBHandler.py | 11 |
2 files changed, 11 insertions, 2 deletions
diff --git a/bitbake/lib/bb/data.py b/bitbake/lib/bb/data.py index d66d98cc8b..6bcfcf46cc 100644 --- a/bitbake/lib/bb/data.py +++ b/bitbake/lib/bb/data.py | |||
@@ -322,8 +322,6 @@ def build_dependencies(key, keys, shelldeps, varflagsexcl, d): | |||
322 | if varflags.get("python"): | 322 | if varflags.get("python"): |
323 | value = d.getVarFlag(key, "_content", False) | 323 | value = d.getVarFlag(key, "_content", False) |
324 | parser = bb.codeparser.PythonParser(key, logger) | 324 | parser = bb.codeparser.PythonParser(key, logger) |
325 | if value and "\t" in value: | ||
326 | logger.warning("Variable %s contains tabs, please remove these (%s)" % (key, d.getVar("FILE"))) | ||
327 | parser.parse_python(value, filename=varflags.get("filename"), lineno=varflags.get("lineno")) | 325 | parser.parse_python(value, filename=varflags.get("filename"), lineno=varflags.get("lineno")) |
328 | deps = deps | parser.references | 326 | deps = deps | parser.references |
329 | deps = deps | (keys & parser.execs) | 327 | deps = deps | (keys & parser.execs) |
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('') |