summaryrefslogtreecommitdiffstats
path: root/lib/bb/utils.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-08 18:16:00 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-05-09 09:46:16 +0100
commit9bc92d0210e13e4cc98727f6c9ec2f47c2221e77 (patch)
treef41909d635bcdaec482d662995b13d2ffe5902d2 /lib/bb/utils.py
parentc5de66b870406d9bd1161a9b7e2b04fe6eb065fe (diff)
downloadbitbake-9bc92d0210e13e4cc98727f6c9ec2f47c2221e77.tar.gz
utils: Improve better_compile error message
Similarly to the better_exec improvements, improve the compile failure messages to be more user readable. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/utils.py')
-rw-r--r--lib/bb/utils.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 9d7a32fb2..462eb689b 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -255,18 +255,20 @@ def better_compile(text, file, realfile, mode = "exec"):
try:
return compile(text, file, mode)
except Exception as e:
+ error = []
# split the text into lines again
body = text.split('\n')
- logger.error("Error in compiling python function in %s", realfile)
- logger.error(str(e))
+ error.append("Error in compiling python function in %s:\n" % realfile)
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])
- logger.error("\n".join(_print_trace(body, e.lineno)))
+ error.append("The code lines resulting in this error were:")
+ error.extend(_print_trace(body, e.lineno))
else:
- logger.error("The function causing this error was:")
+ error.append("The function causing this error was:")
for line in body:
- logger.error(line)
+ error.append(line)
+ error.append("%s: %s" % (e.__class__.__name__, str(e)))
+
+ logger.error("\n".join(error))
e = bb.BBHandledException(e)
raise e