]> code.ossystems Code Review - openembedded-core.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)
committerRichard Purdie <rpurdie@linux.intel.com>
Thu, 19 Aug 2010 22:27:08 +0000 (23:27 +0100)
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
bitbake/lib/bb/utils.py

index 569aa6a8c4a12754d94ddd70265a7d261d7294f7..1778a1e2ee3b277d855a0177a808feeb050e6da9 100644 (file)
@@ -310,13 +310,16 @@ def better_compile(text, file, realfile, mode = "exec"):
         # split the text into lines again
         body = text.split('\n')
         bb.msg.error(bb.msg.domain.Util, "Error in compiling python function in: %s" % (realfile))
-        bb.msg.error(bb.msg.domain.Util, "The lines leading to this error were:")
-        bb.msg.error(bb.msg.domain.Util, "\t%d:%s:'%s'" % (e.lineno, e.__class__.__name__, body[e.lineno-1]))
-
-        _print_trace(body, e.lineno)
-
-        # exit now
-        sys.exit(1)
+        bb.msg.error(bb.msg.domain.Util, str(e))
+        if e.lineno:
+            bb.msg.error(bb.msg.domain.Util, "The lines leading to this error were:")
+            bb.msg.error(bb.msg.domain.Util, "\t%d:%s:'%s'" % (e.lineno, e.__class__.__name__, body[e.lineno-1]))
+            _print_trace(body, e.lineno)
+        else:
+            bb.msg.error(bb.msg.domain.Util, "The function causing this error was:")
+            for line in body:
+                bb.msg.error(bb.msg.domain.Util, line)
+        raise
 
 def better_exec(code, context, text, realfile):
     """