summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2006-03-07 21:42:24 +0000
committerHolger Hans Peter Freyther <zecke@selfish.org>2006-03-07 21:42:24 +0000
commitbec09a6e13da5d6c71d5c113e463274f9fcf26be (patch)
tree0a9cdc66e3d984bd76752560ff59ce00bd2ccb5c
parent0f0d84599f32882abc81c6cfb2c78b515a87f892 (diff)
downloadbitbake-bec09a6e13da5d6c71d5c113e463274f9fcf26be.tar.gz
bitbake/lib/bb/utils.py:
-This not Thiis -Print the RuntimeError with context gosh that is looking awesome. -Now debugging errors in custom bbclasses, python methods should be much more easy
-rw-r--r--lib/bb/utils.py34
1 files changed, 22 insertions, 12 deletions
diff --git a/lib/bb/utils.py b/lib/bb/utils.py
index 53c874f8c..a2b691f67 100644
--- a/lib/bb/utils.py
+++ b/lib/bb/utils.py
@@ -108,7 +108,7 @@ def better_compile(text, file, realfile):
# split the text into lines again
body = text.split('\n')
bb.error("Error in compiling: ", realfile)
- bb.error("The lines resulting into thiis error were:")
+ bb.error("The lines resulting into this error were:")
bb.error("\t%d:%s:'%s'" % (e.lineno, e.__class__.__name__, body[e.lineno-1]))
# print the environment of the method
bb.error("Printing the environment of the function")
@@ -132,19 +132,29 @@ def better_exec(code, context, text, realfile):
exec code in context
except:
(t,value,tb) = sys.exc_info()
- bb.note("error")
- import traceback
- print type(t)
- print type(value)
- print type(tb)
- print t
- print value
- print tb
- print dir(tb)
+ # print the Header of the Error Message
+ bb.error("Error in executing: ", realfile)
+ bb.error("Exception:%s Message:%s" % (t,value) )
+
+ # let us find the line number now
while tb.tb_next:
tb = tb.tb_next
- print "f:%d" %traceback.tb_lineno(tb)
- traceback.print_tb(tb)
+ import traceback
+ line = traceback.tb_lineno(tb)
+
+
+ body = text.split('\n')
+ bb.error("The lines resulting into this error were:")
+ bb.error("\t%d:'%s'" % (line, body[line-1]))
+
+ # print the environment of the method
+ bb.error("Printing the environment of the function")
+ min_line = max(1,line-4)
+ max_line = min(line+4,len(body))
+ for i in range(min_line,max_line+1):
+ bb.error("\t%.4d:%s" % (i, body[i-1]) )
+
+
raise