All of lore.kernel.org
 help / color / mirror / Atom feed
* utils: Improve better_compile error message
@ 2013-05-08 17:16 Richard Purdie
  0 siblings, 0 replies; only message in thread
From: Richard Purdie @ 2013-05-08 17:16 UTC (permalink / raw)
  To: bitbake-devel

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>
---
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 9d7a32f..462eb68 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/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





^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-05-08 17:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-08 17:16 utils: Improve better_compile error message Richard Purdie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.