Allow overriding pycdio dependency

Keep in mind overriding isn’t the suggested behavior.
This commit is contained in:
JoeLametta
2016-07-25 09:56:00 +02:00
parent b5c22da76d
commit 742879ac94
2 changed files with 17 additions and 6 deletions

View File

@@ -52,10 +52,10 @@ REQUIREMENTS
- GStreamer and its python bindings, for encoding
- gstreamer0.10-base-plugins >= 0.10.22 for appsink
- gstreamer0.10-good-plugins for wav encoding (it depends on the Linux distro used)
- python musicbrainz2, for metadata lookup
- python musicbrainzngs, for metadata lookup
- python-setuptools, for plugin support
- python-cddb, for showing but not using disc info if not in MusicBrainz
- pycdio, for drive identification (optional)
- pycdio, for drive identification (it can be overridden placing a blank file named `PYCDIO_IGNORE` into whipper's config path)
- Required for drive offset and caching behavior to be stored in the config file
Additionally, if you're building from a git checkout:

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
from morituri.common import drive, program, task, directory
from morituri.result import result
from morituri.program import cdrdao, cdparanoia
from morituri.rip import common as rcommon
@@ -168,9 +168,20 @@ class _CD(logcommand.LogCommand):
self.program.result.release = \
cdio.Device(self.device).get_hwinfo()
except ImportError:
raise ImportError("Pycdio module import failed.\n"
"This is a hard dependency: if not available "
"please install it")
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")
self.doCommand()