diff options
author | Chris Larson <chris_larson@mentor.com> | 2010-03-31 08:59:00 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2011-01-04 14:36:54 +0000 |
commit | bac0c60b61941354aaadee5f1ecb2a32749cc8cd (patch) | |
tree | 943c0c108b3a8013f359147f00592da2d3a167f1 /bitbake/lib/bb | |
parent | 947577a77d3066a443be2583685cc909196f6b1c (diff) | |
download | openembedded-core-bac0c60b61941354aaadee5f1ecb2a32749cc8cd.tar.gz openembedded-core-bac0c60b61941354aaadee5f1ecb2a32749cc8cd.tar.bz2 openembedded-core-bac0c60b61941354aaadee5f1ecb2a32749cc8cd.tar.xz openembedded-core-bac0c60b61941354aaadee5f1ecb2a32749cc8cd.zip |
Make realfile optional for better_exec, using the existing fn in the code object
(Bitbake rev: 499a2d28d578cdd6df7cd30ccb79cc2b2796fb65)
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb')
-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 e02969c07..922b7256e 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"): bb.msg.error(bb.msg.domain.Util, line) raise -def better_exec(code, context, text, realfile): +def better_exec(code, context, text, realfile = "<code>"): """ Similiar to better_compile, better_exec will print the lines that are responsible for the error. """ import bb.parse + if not hasattr(code, "co_filename"): + code = better_compile(code, realfile, realfile) try: exec(code, _context, context) except: @@ -350,7 +352,7 @@ def better_exec(code, context, text, realfile): raise # print the Header of the Error Message - bb.msg.error(bb.msg.domain.Util, "There was an error when executing a python function in: %s" % realfile) + bb.msg.error(bb.msg.domain.Util, "There was an error when executing a python function in: %s" % code.co_filename) bb.msg.error(bb.msg.domain.Util, "Exception:%s Message:%s" % (t, value)) # Strip 'us' from the stack (better_exec call) |