diff options
author | Richard Purdie <rpurdie@linux.intel.com> | 2010-08-19 23:26:46 +0100 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-08-19 23:27:08 +0100 |
commit | 6e3a3816d5ba4b074f3c119437660fc72efe9fdc (patch) | |
tree | 6e2c5afe4b55df0a846e9be241651b55c5d4cf97 | |
parent | f070ee959c8eb4d49f820ec46f22be221b46485a (diff) | |
download | poky-6e3a3816d5ba4b074f3c119437660fc72efe9fdc.tar.gz |
bitbake/utils.py: Give useful debug information when no lineno information is available
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
-rw-r--r-- | bitbake/lib/bb/utils.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index 569aa6a8c4..1778a1e2ee 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -310,13 +310,16 @@ def better_compile(text, file, realfile, mode = "exec"): | |||
310 | # split the text into lines again | 310 | # split the text into lines again |
311 | body = text.split('\n') | 311 | body = text.split('\n') |
312 | bb.msg.error(bb.msg.domain.Util, "Error in compiling python function in: %s" % (realfile)) | 312 | bb.msg.error(bb.msg.domain.Util, "Error in compiling python function in: %s" % (realfile)) |
313 | bb.msg.error(bb.msg.domain.Util, "The lines leading to this error were:") | 313 | bb.msg.error(bb.msg.domain.Util, str(e)) |
314 | bb.msg.error(bb.msg.domain.Util, "\t%d:%s:'%s'" % (e.lineno, e.__class__.__name__, body[e.lineno-1])) | 314 | if e.lineno: |
315 | 315 | bb.msg.error(bb.msg.domain.Util, "The lines leading to this error were:") | |
316 | _print_trace(body, e.lineno) | 316 | bb.msg.error(bb.msg.domain.Util, "\t%d:%s:'%s'" % (e.lineno, e.__class__.__name__, body[e.lineno-1])) |
317 | 317 | _print_trace(body, e.lineno) | |
318 | # exit now | 318 | else: |
319 | sys.exit(1) | 319 | bb.msg.error(bb.msg.domain.Util, "The function causing this error was:") |
320 | for line in body: | ||
321 | bb.msg.error(bb.msg.domain.Util, line) | ||
322 | raise | ||
320 | 323 | ||
321 | def better_exec(code, context, text, realfile): | 324 | def better_exec(code, context, text, realfile): |
322 | """ | 325 | """ |