summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r--bitbake/lib/bb/utils.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 44a42a0136..e0ef63cd03 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -218,7 +218,7 @@ def better_compile(text, file, realfile, mode = "exec"):
218 218
219 raise 219 raise
220 220
221def better_exec(code, context, text = None, realfile = "<code>", data = None): 221def better_exec(code, context, text = None, realfile = "<code>"):
222 """ 222 """
223 Similiar to better_compile, better_exec will 223 Similiar to better_compile, better_exec will
224 print the lines that are responsible for the 224 print the lines that are responsible for the
@@ -256,16 +256,25 @@ def better_exec(code, context, text = None, realfile = "<code>", data = None):
256 256
257 logger.error("The code that was being executed was:") 257 logger.error("The code that was being executed was:")
258 _print_trace(textarray, linefailed) 258 _print_trace(textarray, linefailed)
259 logger.error("(file: '%s', lineno: %s, function: %s)", tbextract[0][0], tbextract[0][1], tbextract[0][2]) 259 logger.error("[From file: '%s', lineno: %s, function: %s]", tbextract[0][0], tbextract[0][1], tbextract[0][2])
260 260
261 # See if this is a function we constructed and has calls back into other functions in 261 # See if this is a function we constructed and has calls back into other functions in
262 # "text". If so, try and improve the context of the error by diving down the trace 262 # "text". If so, try and improve the context of the error by diving down the trace
263 level = 0 263 level = 0
264 nexttb = tb.tb_next 264 nexttb = tb.tb_next
265 while nexttb is not None: 265 while nexttb is not None and (level+1) < len(tbextract):
266 if tbextract[level][0] == tbextract[level+1][0] and tbextract[level+1][2] == tbextract[level][0]: 266 if tbextract[level][0] == tbextract[level+1][0] and tbextract[level+1][2] == tbextract[level][0]:
267 _print_trace(textarray, tbextract[level+1][1]) 267 _print_trace(textarray, tbextract[level+1][1])
268 logger.error("(file: '%s', lineno: %s, function: %s)", tbextract[level+1][0], tbextract[level+1][1], tbextract[level+1][2]) 268 logger.error("[From file: '%s', lineno: %s, function: %s]", tbextract[level+1][0], tbextract[level+1][1], tbextract[level+1][2])
269 elif "d" in context and tbextract[level+1][2]:
270 d = context["d"]
271 functionname = tbextract[level+1][2]
272 text = d.getVar(functionname, True)
273 if text:
274 _print_trace(text.split('\n'), tbextract[level+1][1])
275 logger.error("[From file: '%s', lineno: %s, function: %s]", tbextract[level+1][0], tbextract[level+1][1], tbextract[level+1][2])
276 else:
277 break
269 else: 278 else:
270 break 279 break
271 nexttb = tb.tb_next 280 nexttb = tb.tb_next