From c824277b602590f2f4af8b553106b6913e62fad2 Mon Sep 17 00:00:00 2001 From: Caiwen Zhang Date: Thu, 12 Feb 2015 10:31:49 +0800 Subject: [PATCH] Improve external library management error handling Change-Id: I2a0b7003f0bd2987fa101285977fa0621688017b Signed-off-by: Caiwen Zhang Reviewed-on: https://gerrit.iotivity.org/gerrit/327 Tested-by: jenkins-iotivity Reviewed-by: Patrick Lankswert --- build_common/tools/UnpackAll.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/build_common/tools/UnpackAll.py b/build_common/tools/UnpackAll.py index 4e24c58..0df17e4 100644 --- a/build_common/tools/UnpackAll.py +++ b/build_common/tools/UnpackAll.py @@ -161,8 +161,15 @@ def __message( s, target, source, env ) : # @param source extracted files # @param env environment object def __action( target, source, env ) : + cwd = os.path.realpath('.') extractor = __getExtractor([File(source)], env) if not extractor : + print '''******************************* Error ***************************************** +* +* Doesn't support auto extracting [%s], please extract it to [%s]. +* * +******************************************************************************* +''' % (source, cwd) raise SCons.Errors.StopError( "can not find any extractor value for the source file [%s]" % (source) ) extractor_cmd = extractor["EXTRACTCMD"] @@ -175,7 +182,6 @@ def __action( target, source, env ) : handle = None cmd = env.subst(extractor_cmd, source=source, target=target) - cwd = os.path.realpath('.') if env["UNPACK"]["VIWEXTRACTOUTPUT"] : handle = subprocess.Popen( cmd, shell=True ) @@ -186,12 +192,12 @@ def __action( target, source, env ) : if handle.wait() <> 0 : print '''******************************* Error ***************************************** * -* Fail to unpack (%s). It should be due to it isn't downloaded completely. -* Please download it manually or delete it and let the script auto -* download again. -* +* Fail to unpack [%s]. It should be due to it isn't downloaded completely. +* Please download it manually or delete it and let the script auto download it* +* again. * +* * ******************************************************************************* -''' +''' % (source) raise SCons.Errors.BuildError( "error running extractor [%s] on the source [%s]" % (cmd, source) ) # emitter function for getting the files -- 2.7.4