Patchwork [09/10] wic: Make find_binary_path() more user-friendly

login
register
mail settings
Submitter tom.zanussi@linux.intel.com
Date Oct. 22, 2013, 2:24 p.m.
Message ID <014a56fc9394cafb6de0258ba99831ce5f58f52e.1382451106.git.tom.zanussi@linux.intel.com>
Download mbox | patch
Permalink /patch/60375/
State Accepted
Commit 8ac545481f00a9480582255bbfdd61714b820159
Headers show

Comments

tom.zanussi@linux.intel.com - Oct. 22, 2013, 2:24 p.m.
find_binary_path() is useful, but if the binary isn't found, it prints
a stacktrace and a less-than-useful message.  Users complain when they
get stacktraces for things they can act on, so remove the stacktrace
and tell the user what the problem is.

Signed-off-by: Tom Zanussi <tom.zanussi@linux.intel.com>
---
 scripts/lib/mic/utils/fs_related.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Patch

diff --git a/scripts/lib/mic/utils/fs_related.py b/scripts/lib/mic/utils/fs_related.py
index 6161735..dd420e8 100644
--- a/scripts/lib/mic/utils/fs_related.py
+++ b/scripts/lib/mic/utils/fs_related.py
@@ -57,7 +57,10 @@  def find_binary_path(binary):
         bin_path = "%s/%s" % (path, binary)
         if os.path.exists(bin_path):
             return bin_path
-    raise CreatorError("Command '%s' is not available." % binary)
+
+    print "External command '%s' not found, exiting." % binary
+    print "  (Please install '%s' on your host system)" % binary
+    sys.exit(1)
 
 def makedirs(dirname):
     """A version of os.makedirs() that doesn't throw an