summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/exceptions.py
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2011-05-05 19:07:21 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-06-08 20:38:24 +0100
commit63d14f474d52430f19653ef7ed881cd8dbaf3f42 (patch)
tree12af74e708c84ef11ae55d0bbffa037e720ae150 /bitbake/lib/bb/exceptions.py
parent5b4b6bc7f7b24cb02811905b065304ba6b7e6e07 (diff)
downloadpoky-63d14f474d52430f19653ef7ed881cd8dbaf3f42.tar.gz
bb.exceptions: handle tb entries without context
(Bitbake rev: b010c4d37cfff5f74747d7da8cc1bf6719e29357) Signed-off-by: Chris Larson <chris_larson@mentor.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/exceptions.py')
-rw-r--r--bitbake/lib/bb/exceptions.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/bitbake/lib/bb/exceptions.py b/bitbake/lib/bb/exceptions.py
index e134ae136d..86621d24ba 100644
--- a/bitbake/lib/bb/exceptions.py
+++ b/bitbake/lib/bb/exceptions.py
@@ -8,10 +8,13 @@ from collections import namedtuple
8class TracebackEntry(namedtuple.abc): 8class TracebackEntry(namedtuple.abc):
9 """Pickleable representation of a traceback entry""" 9 """Pickleable representation of a traceback entry"""
10 _fields = 'filename lineno function args code_context index' 10 _fields = 'filename lineno function args code_context index'
11 _header = ' File "{0.filename}", line {0.lineno}, in {0.function}{0.args}:\n' 11 _header = ' File "{0.filename}", line {0.lineno}, in {0.function}{0.args}'
12 12
13 def format(self, formatter=None): 13 def format(self, formatter=None):
14 formatted = [self._header.format(self)] 14 if not self.code_context:
15 return self._header.format(self) + '\n'
16
17 formatted = [self._header.format(self) + ':\n']
15 18
16 for lineindex, line in enumerate(self.code_context): 19 for lineindex, line in enumerate(self.code_context):
17 if formatter: 20 if formatter: