diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-21 11:00:34 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-21 11:12:15 +0000 |
commit | b42273a909f86776a0398077563d7b3fee92f3cb (patch) | |
tree | 07943ad67e0580797a48b3ac703e2d92753d5f01 /meta/lib/oe/path.py | |
parent | 0a8f4f45b66ad5d51dea91a406a17555252dfe42 (diff) | |
download | poky-b42273a909f86776a0398077563d7b3fee92f3cb.tar.gz |
lib/oe/path.py: Add expection class to handle the output argument
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/path.py')
-rw-r--r-- | meta/lib/oe/path.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/meta/lib/oe/path.py b/meta/lib/oe/path.py index 74674bfee8..48138605d0 100644 --- a/meta/lib/oe/path.py +++ b/meta/lib/oe/path.py | |||
@@ -80,6 +80,13 @@ def symlink(source, destination, force=False): | |||
80 | if e.errno != errno.EEXIST or os.readlink(destination) != source: | 80 | if e.errno != errno.EEXIST or os.readlink(destination) != source: |
81 | raise | 81 | raise |
82 | 82 | ||
83 | class CalledProcessError(Exception): | ||
84 | def __init__(self, retcode, cmd, output = None): | ||
85 | self.retcode = retcode | ||
86 | self.cmd = cmd | ||
87 | self.output = output | ||
88 | def __str__(self): | ||
89 | return "Command '%s' returned non-zero exit status %d with output %s" % (self.cmd, self.retcode, self.output) | ||
83 | 90 | ||
84 | # Not needed when we move to python 2.7 | 91 | # Not needed when we move to python 2.7 |
85 | def check_output(*popenargs, **kwargs): | 92 | def check_output(*popenargs, **kwargs): |
@@ -111,6 +118,6 @@ def check_output(*popenargs, **kwargs): | |||
111 | cmd = kwargs.get("args") | 118 | cmd = kwargs.get("args") |
112 | if cmd is None: | 119 | if cmd is None: |
113 | cmd = popenargs[0] | 120 | cmd = popenargs[0] |
114 | raise subprocess.CalledProcessError(retcode, cmd, output=output) | 121 | raise CalledProcessError(retcode, cmd, output=output) |
115 | return output | 122 | return output |
116 | 123 | ||