mirror of
https://git.yoctoproject.org/poky
synced 2026-06-01 00:59:48 +00:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
947577a77d
commit
bac0c60b61
@@ -334,13 +334,15 @@ def better_compile(text, file, realfile, mode = "exec"):
|
|||||||
bb.msg.error(bb.msg.domain.Util, line)
|
bb.msg.error(bb.msg.domain.Util, line)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def better_exec(code, context, text, realfile):
|
def better_exec(code, context, text, realfile = "<code>"):
|
||||||
"""
|
"""
|
||||||
Similiar to better_compile, better_exec will
|
Similiar to better_compile, better_exec will
|
||||||
print the lines that are responsible for the
|
print the lines that are responsible for the
|
||||||
error.
|
error.
|
||||||
"""
|
"""
|
||||||
import bb.parse
|
import bb.parse
|
||||||
|
if not hasattr(code, "co_filename"):
|
||||||
|
code = better_compile(code, realfile, realfile)
|
||||||
try:
|
try:
|
||||||
exec(code, _context, context)
|
exec(code, _context, context)
|
||||||
except:
|
except:
|
||||||
@@ -350,7 +352,7 @@ def better_exec(code, context, text, realfile):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
# print the Header of the Error Message
|
# 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))
|
bb.msg.error(bb.msg.domain.Util, "Exception:%s Message:%s" % (t, value))
|
||||||
|
|
||||||
# Strip 'us' from the stack (better_exec call)
|
# Strip 'us' from the stack (better_exec call)
|
||||||
|
|||||||
Reference in New Issue
Block a user