diff options
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/utils.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index e02969c07f..922b7256e3 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py | |||
@@ -334,13 +334,15 @@ def better_compile(text, file, realfile, mode = "exec"): | |||
334 | bb.msg.error(bb.msg.domain.Util, line) | 334 | bb.msg.error(bb.msg.domain.Util, line) |
335 | raise | 335 | raise |
336 | 336 | ||
337 | def better_exec(code, context, text, realfile): | 337 | def better_exec(code, context, text, realfile = "<code>"): |
338 | """ | 338 | """ |
339 | Similiar to better_compile, better_exec will | 339 | Similiar to better_compile, better_exec will |
340 | print the lines that are responsible for the | 340 | print the lines that are responsible for the |
341 | error. | 341 | error. |
342 | """ | 342 | """ |
343 | import bb.parse | 343 | import bb.parse |
344 | if not hasattr(code, "co_filename"): | ||
345 | code = better_compile(code, realfile, realfile) | ||
344 | try: | 346 | try: |
345 | exec(code, _context, context) | 347 | exec(code, _context, context) |
346 | except: | 348 | except: |
@@ -350,7 +352,7 @@ def better_exec(code, context, text, realfile): | |||
350 | raise | 352 | raise |
351 | 353 | ||
352 | # print the Header of the Error Message | 354 | # print the Header of the Error Message |
353 | bb.msg.error(bb.msg.domain.Util, "There was an error when executing a python function in: %s" % realfile) | 355 | bb.msg.error(bb.msg.domain.Util, "There was an error when executing a python function in: %s" % code.co_filename) |
354 | bb.msg.error(bb.msg.domain.Util, "Exception:%s Message:%s" % (t, value)) | 356 | bb.msg.error(bb.msg.domain.Util, "Exception:%s Message:%s" % (t, value)) |
355 | 357 | ||
356 | # Strip 'us' from the stack (better_exec call) | 358 | # Strip 'us' from the stack (better_exec call) |