summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/utils.py
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2011-01-01 23:55:54 +0000
committerRichard Purdie <rpurdie@linux.intel.com>2011-01-04 14:46:54 +0000
commit0090a798eb868ebc926944eac2e6d4a5aff3e1b3 (patch)
tree9b90e66234e6ad7b9616c8c5944029426746110f /bitbake/lib/bb/utils.py
parente8c48e668c7525257926ab7db9b6e44aa2705483 (diff)
downloadpoky-0090a798eb868ebc926944eac2e6d4a5aff3e1b3.tar.gz
bitbake: Sync a load of whitespace and other non-functionality changes with bitbake uptream
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb/utils.py')
-rw-r--r--bitbake/lib/bb/utils.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 3018f3e5d5..48ed0d72e5 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -311,10 +311,9 @@ def _print_trace(body, line):
311 max_line = min(line + 4, len(body)) 311 max_line = min(line + 4, len(body))
312 for i in xrange(min_line, max_line + 1): 312 for i in xrange(min_line, max_line + 1):
313 if line == i: 313 if line == i:
314 logger.error(" *** %.4d:%s" % (i, body[i-1]) ) 314 logger.error(' *** %.4d:%s', i, body[i-1])
315 else: 315 else:
316 logger.error(" %.4d:%s" % (i, body[i-1]) ) 316 logger.error(' %.4d:%s', i, body[i-1])
317
318 317
319def better_compile(text, file, realfile, mode = "exec"): 318def better_compile(text, file, realfile, mode = "exec"):
320 """ 319 """
@@ -326,16 +325,17 @@ def better_compile(text, file, realfile, mode = "exec"):
326 except Exception as e: 325 except Exception as e:
327 # split the text into lines again 326 # split the text into lines again
328 body = text.split('\n') 327 body = text.split('\n')
329 logger.error("Error in compiling python function in: %s" % (realfile)) 328 logger.error("Error in compiling python function in %s", realfile)
330 logger.error(str(e)) 329 logger.error(str(e))
331 if e.lineno: 330 if e.lineno:
332 logger.error("The lines leading to this error were:") 331 logger.error("The lines leading to this error were:")
333 logger.error("\t%d:%s:'%s'" % (e.lineno, e.__class__.__name__, body[e.lineno-1])) 332 logger.error("\t%d:%s:'%s'", e.lineno, e.__class__.__name__, body[e.lineno-1])
334 _print_trace(body, e.lineno) 333 _print_trace(body, e.lineno)
335 else: 334 else:
336 logger.error("The function causing this error was:") 335 logger.error("The function causing this error was:")
337 for line in body: 336 for line in body:
338 logger.error(line) 337 logger.error(line)
338
339 raise 339 raise
340 340
341def better_exec(code, context, text, realfile = "<code>"): 341def better_exec(code, context, text, realfile = "<code>"):
@@ -376,16 +376,16 @@ def better_exec(code, context, text, realfile = "<code>"):
376 376
377 logger.error("The code that was being executed was:") 377 logger.error("The code that was being executed was:")
378 _print_trace(textarray, linefailed) 378 _print_trace(textarray, linefailed)
379 logger.error("(file: '%s', lineno: %s, function: %s)" % (tbextract[0][0], tbextract[0][1], tbextract[0][2])) 379 logger.error("(file: '%s', lineno: %s, function: %s)", tbextract[0][0], tbextract[0][1], tbextract[0][2])
380 380
381 # See if this is a function we constructed and has calls back into other functions in 381 # See if this is a function we constructed and has calls back into other functions in
382 # "text". If so, try and improve the context of the error by diving down the trace 382 # "text". If so, try and improve the context of the error by diving down the trace
383 level = 0 383 level = 0
384 nexttb = tb.tb_next 384 nexttb = tb.tb_next
385 while nexttb is not None: 385 while nexttb is not None:
386 if tbextract[level][0] == tbextract[level+1][0] and tbextract[level+1][2] == tbextract[level][0]: 386 if tbextract[level][0] == tbextract[level+1][0] and tbextract[level+1][2] == tbextract[level][0]:
387 _print_trace(textarray, tbextract[level+1][1]) 387 _print_trace(textarray, tbextract[level+1][1])
388 logger.error("(file: '%s', lineno: %s, function: %s)" % (tbextract[level+1][0], tbextract[level+1][1], tbextract[level+1][2])) 388 logger.error("(file: '%s', lineno: %s, function: %s)", tbextract[level+1][0], tbextract[level+1][1], tbextract[level+1][2])
389 else: 389 else:
390 break 390 break
391 nexttb = tb.tb_next 391 nexttb = tb.tb_next