Make pycdio dependency not overridable

This commit is contained in:
JoeLametta
2016-09-05 17:14:11 +02:00
parent e7ff3c1b07
commit 67ea220604
2 changed files with 5 additions and 17 deletions

View File

@@ -30,7 +30,7 @@ import gobject
gobject.threads_init()
from morituri.common import logcommand, common, accurip, gstreamer
from morituri.common import drive, program, task, directory
from morituri.common import drive, program, task
from morituri.result import result
from morituri.program import cdrdao, cdparanoia
from morituri.rip import common as rcommon
@@ -161,27 +161,15 @@ class _CD(logcommand.LogCommand):
self.program.result.title = self.program.metadata \
and self.program.metadata.title \
or 'Unknown Title'
# cdio is optional for now
try:
import cdio
_, self.program.result.vendor, self.program.result.model, \
self.program.result.release = \
cdio.Device(self.device).get_hwinfo()
except ImportError:
d = directory.Directory()
path = os.path.dirname(d.getConfig())
fullPath = os.path.join(path, 'PYCDIO_IGNORE')
if os.path.isfile(fullPath):
self.stdout.write(
'WARNING: pycdio not installed, cannot identify drive '
'(hard dependency overridden)\n')
self.program.result.vendor = 'Unknown'
self.program.result.model = 'Unknown'
self.program.result.release = 'Unknown'
else:
raise ImportError("Pycdio module import failed.\n"
"This is a hard dependency: if not "
"available please install it")
raise ImportError("Pycdio module import failed.\n"
"This is a hard dependency: if not "
"available please install it")
self.doCommand()