]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
lib/oe/path.py: Add expection class to handle the output argument
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 21 Feb 2011 11:00:34 +0000 (11:00 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 21 Feb 2011 11:12:15 +0000 (11:12 +0000)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/path.py

index 74674bfee8a7a1a7b21bf9696a42fcc26a0d14b8..48138605d02c0f70f48ce7e710f8a09b664f8ff7 100644 (file)
@@ -80,6 +80,13 @@ def symlink(source, destination, force=False):
         if e.errno != errno.EEXIST or os.readlink(destination) != source:
             raise
 
+class CalledProcessError(Exception):
+    def __init__(self, retcode, cmd, output = None):
+        self.retcode = retcode
+        self.cmd = cmd
+        self.output = output
+    def __str__(self):
+        return "Command '%s' returned non-zero exit status %d with output %s" % (self.cmd, self.retcode, self.output)
 
 # Not needed when we move to python 2.7
 def check_output(*popenargs, **kwargs):
@@ -111,6 +118,6 @@ def check_output(*popenargs, **kwargs):
         cmd = kwargs.get("args")
         if cmd is None:
             cmd = popenargs[0]
-        raise subprocess.CalledProcessError(retcode, cmd, output=output)
+        raise CalledProcessError(retcode, cmd, output=output)
     return output