From: Richard Purdie Date: Thu, 19 Aug 2010 22:26:46 +0000 (+0100) Subject: bitbake/utils.py: Give useful debug information when no lineno information is available X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=873633d8bc15fa50bf642e864b2953f66a4d74b2;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git bitbake/utils.py: Give useful debug information when no lineno information is available Signed-off-by: Richard Purdie Signed-off-by: Chris Larson --- diff --git a/lib/bb/utils.py b/lib/bb/utils.py index 546a72b377e..edc0f497588 100644 --- a/lib/bb/utils.py +++ b/lib/bb/utils.py @@ -313,13 +313,17 @@ def better_compile(text, file, realfile, mode = "exec"): # split the text into lines again body = text.split('\n') logger.error("Error in compiling python function in %s", realfile) - logger.error("The lines leading to this error were:") - logger.error("\t%d:%s:'%s'", e.lineno, e.__class__.__name__, body[e.lineno-1]) - - _print_trace(body, e.lineno) + logger.error(str(e)) + if e.lineno: + logger.error("The lines leading to this error were:") + logger.error("\t%d:%s:'%s'", e.lineno, e.__class__.__name__, body[e.lineno-1]) + _print_trace(body, e.lineno) + else: + logger.error("The function causing this error was:") + for line in body: + logger.error(line) - # exit now - sys.exit(1) + raise def better_exec(code, context, text, realfile = ""): """