summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/utils.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index cd5fcede3c..9a3efb25de 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -292,7 +292,7 @@ def _print_trace(body, line):
292 error.append(' %.4d:%s' % (i, body[i-1].rstrip())) 292 error.append(' %.4d:%s' % (i, body[i-1].rstrip()))
293 return error 293 return error
294 294
295def better_compile(text, file, realfile, mode = "exec", lineno = None): 295def better_compile(text, file, realfile, mode = "exec", lineno = 0):
296 """ 296 """
297 A better compile method. This method 297 A better compile method. This method
298 will print the offending lines. 298 will print the offending lines.
@@ -301,10 +301,9 @@ def better_compile(text, file, realfile, mode = "exec", lineno = None):
301 cache = bb.methodpool.compile_cache(text) 301 cache = bb.methodpool.compile_cache(text)
302 if cache: 302 if cache:
303 return cache 303 return cache
304 code = compile(text, realfile, mode, ast.PyCF_ONLY_AST) 304 # We can't add to the linenumbers for compile, we can pad to the correct number of blank lines though
305 if lineno is not None: 305 text2 = "\n" * int(lineno) + text
306 ast.increment_lineno(code, lineno) 306 code = compile(text2, realfile, mode)
307 code = compile(code, realfile, mode)
308 bb.methodpool.compile_cache_add(text, code) 307 bb.methodpool.compile_cache_add(text, code)
309 return code 308 return code
310 except Exception as e: 309 except Exception as e: