* morituri/common/common.py:
Add MissingDependencyException. * morituri/program/cdrdao.py: * morituri/rip/main.py: Use it to warn about missing cdrdao.
This commit is contained in:
@@ -1,3 +1,11 @@
|
||||
2010-06-19 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* morituri/common/common.py:
|
||||
Add MissingDependencyException.
|
||||
* morituri/program/cdrdao.py:
|
||||
* morituri/rip/main.py:
|
||||
Use it to warn about missing cdrdao.
|
||||
|
||||
2010-06-18 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||
|
||||
* morituri/common/task.py:
|
||||
|
||||
@@ -205,3 +205,10 @@ def tagListEquals(tl1, tl2):
|
||||
d2 = tagListToDict(tl2)
|
||||
|
||||
return d1 == d2
|
||||
|
||||
class MissingDependencyException(Exception):
|
||||
dependency = None
|
||||
|
||||
def __init__(self, *args):
|
||||
self.args = args
|
||||
self.dependency = args[0]
|
||||
|
||||
@@ -250,10 +250,18 @@ class CDRDAOTask(task.Task):
|
||||
task.Task.start(self, runner)
|
||||
|
||||
bufsize = 1024
|
||||
self._popen = asyncsub.Popen(["cdrdao", ] + self.options,
|
||||
bufsize=bufsize,
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE, close_fds=True)
|
||||
try:
|
||||
self._popen = asyncsub.Popen(["cdrdao", ] + self.options,
|
||||
bufsize=bufsize,
|
||||
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE, close_fds=True)
|
||||
except OSError, e:
|
||||
import errno
|
||||
if e.errno == errno.ENOENT:
|
||||
raise common.MissingDependencyException('cdrdao')
|
||||
|
||||
raise
|
||||
|
||||
self.debug('Started cdrdao with pid %d and options %r',
|
||||
self._popen.pid, self.options)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
import sys
|
||||
|
||||
from morituri.common import log, logcommand
|
||||
from morituri.common import log, logcommand, common, task
|
||||
from morituri.rip import cd, offset, drive, image
|
||||
|
||||
def main(argv):
|
||||
@@ -18,6 +18,12 @@ def main(argv):
|
||||
raise
|
||||
# deps.handleImportError(e)
|
||||
# ret = -1
|
||||
except task.TaskException, e:
|
||||
if isinstance(e.exception, common.MissingDependencyException):
|
||||
sys.stderr.write('rip: error: missing dependency "%s"\n' %
|
||||
e.exception.dependency)
|
||||
return 255
|
||||
raise
|
||||
|
||||
if ret is None:
|
||||
return 0
|
||||
|
||||
Reference in New Issue
Block a user