get version for cdrdao too.

Add debug commands: rip debug version cdrdao/cdparanoia
This commit is contained in:
Thomas Vander Stichele
2013-07-13 11:31:27 +02:00
parent cc2ee6ba07
commit 7813103a4d
7 changed files with 106 additions and 25 deletions

View File

@@ -550,25 +550,12 @@ _VERSION_RE = re.compile(
def getCdParanoiaVersion():
version = "(Unknown)"
getter = common.VersionGetter('cdparanoia',
["cdparanoia", "-V"],
_VERSION_RE,
"%(version)s %(release)s")
try:
p = asyncsub.Popen(["cdparanoia", "-V"],
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, close_fds=True)
version = asyncsub.recv_some(p, e=0, stderr=1)
vre = _VERSION_RE.search(version)
if vre and len(vre.groups()) == 2:
version = "%s %s" % (
vre.groupdict().get('version'),
vre.groupdict().get('release'))
except OSError, e:
import errno
if e.errno == errno.ENOENT:
raise common.MissingDependencyException('cdparanoia')
raise
return version
return getter.get()
_OK_RE = re.compile(r'Drive tests OK with Paranoia.')

View File

@@ -507,3 +507,16 @@ class ProgramFailedException(Exception):
def __init__(self, code):
self.code = code
self.args = (code, )
_VERSION_RE = re.compile(
"^Cdrdao version (?P<version>.+) -")
def getCDRDAOVersion():
getter = common.VersionGetter('cdrdao',
["cdrdao"],
_VERSION_RE,
"%(version)s")
return getter.get()