]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
bitbake/utils.py: Give useful debug information when no lineno information is available
authorRichard Purdie <rpurdie@linux.intel.com>
Thu, 19 Aug 2010 22:26:46 +0000 (23:26 +0100)
committerChris Larson <chris_larson@mentor.com>
Fri, 3 Dec 2010 19:24:46 +0000 (12:24 -0700)
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Signed-off-by: Chris Larson <chris_larson@mentor.com>
lib/bb/utils.py

index 546a72b377e309651e0efbb367fb37656fcd06a2..edc0f497588b074f13c36e2d52b869c6b38216c8 100644 (file)
@@ -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 = "<code>"):
     """