diff options
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r-- | bitbake/lib/bb/utils.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 3b0c9599c4..13bb5f2a05 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -318,10 +318,13 @@ def better_compile(text, file, realfile, mode = "exec", lineno = 0): | |||
318 | error = [] | 318 | error = [] |
319 | # split the text into lines again | 319 | # split the text into lines again |
320 | body = text.split('\n') | 320 | body = text.split('\n') |
321 | error.append("Error in compiling python function in %s, line %s:\n" % (realfile, lineno)) | 321 | error.append("Error in compiling python function in %s, line %s:\n" % (realfile, e.lineno)) |
322 | if hasattr(e, "lineno"): | 322 | if hasattr(e, "lineno"): |
323 | error.append("The code lines resulting in this error were:") | 323 | error.append("The code lines resulting in this error were:") |
324 | error.extend(_print_trace(body, e.lineno)) | 324 | # e.lineno: line's position in reaflile |
325 | # lineno: function name's "position -1" in realfile | ||
326 | # e.lineno - lineno: line's relative position in function | ||
327 | error.extend(_print_trace(body, e.lineno - lineno)) | ||
325 | else: | 328 | else: |
326 | error.append("The function causing this error was:") | 329 | error.append("The function causing this error was:") |
327 | for line in body: | 330 | for line in body: |