From patchwork Wed Aug 22 19:02:39 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [bitbake-devel] utils.py: Once we've printed errors messages, suppress the backtrace Date: Wed, 22 Aug 2012 19:02:39 -0000 From: Richard Purdie X-Patchwork-Id: 35159 Message-Id: <1345662159.3907.129.camel@ted> To: bitbake-devel Adding a generic backtrace to better_compile and better_exec is pointless, therefore reraise the exception as a bb.BBHandledException so the generic code doesn't confuse the user even more. Signed-off-by: Richard Purdie --- diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index e0ef63c..82dab6b 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -216,7 +216,8 @@ def better_compile(text, file, realfile, mode = "exec"): for line in body: logger.error(line) - raise + e = bb.BBHandledException(e) + raise e def better_exec(code, context, text = None, realfile = ""): """ @@ -231,7 +232,7 @@ def better_exec(code, context, text = None, realfile = ""): code = better_compile(code, realfile, realfile) try: exec(code, _context, context) - except Exception: + except Exception as e: (t, value, tb) = sys.exc_info() if t in [bb.parse.SkipPackage, bb.build.FuncFailed]: @@ -280,7 +281,8 @@ def better_exec(code, context, text = None, realfile = ""): nexttb = tb.tb_next level = level + 1 - raise + e = bb.BBHandledException(e) + raise e def simple_exec(code, context): exec(code, _context, context)