use python-deps to handle missing dependencies.
Apply it to gst python module.
This commit is contained in:
@@ -9,6 +9,7 @@ morituri_PYTHON = \
|
|||||||
cache.py \
|
cache.py \
|
||||||
common.py \
|
common.py \
|
||||||
config.py \
|
config.py \
|
||||||
|
deps.py \
|
||||||
directory.py \
|
directory.py \
|
||||||
drive.py \
|
drive.py \
|
||||||
encode.py \
|
encode.py \
|
||||||
|
|||||||
34
morituri/common/deps.py
Normal file
34
morituri/common/deps.py
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# -*- Mode: Python -*-
|
||||||
|
# vi:si:et:sw=4:sts=4:ts=4
|
||||||
|
|
||||||
|
import os
|
||||||
|
import urllib
|
||||||
|
|
||||||
|
from morituri.extern.deps import deps
|
||||||
|
|
||||||
|
|
||||||
|
class DepsHandler(deps.DepsHandler):
|
||||||
|
|
||||||
|
def __init__(self, name='morituri'):
|
||||||
|
deps.DepsHandler.__init__(self, name)
|
||||||
|
|
||||||
|
self.add(GStPython())
|
||||||
|
|
||||||
|
def report(self, summary):
|
||||||
|
reporter = os.environ.get('EMAIL_ADDRESS', None)
|
||||||
|
get = "summary=%s" % urllib.quote(summary)
|
||||||
|
if reporter:
|
||||||
|
get += "&reporter=%s" % urllib.quote(reporter)
|
||||||
|
return 'http://thomas.apestaart.org/morituri/trac/newticket?' + get
|
||||||
|
|
||||||
|
|
||||||
|
class GStPython(deps.Dependency):
|
||||||
|
module = 'gst'
|
||||||
|
name = "GStreamer Python bindings"
|
||||||
|
homepage = "http://gstreamer.freedesktop.org"
|
||||||
|
|
||||||
|
def Fedora_install(self, distro):
|
||||||
|
return self.Fedora_yum('gstreamer-python')
|
||||||
|
|
||||||
|
#def Ubuntu_install(self, distro):
|
||||||
|
# pass
|
||||||
8
morituri/extern/Makefile.am
vendored
8
morituri/extern/Makefile.am
vendored
@@ -18,6 +18,14 @@ command_PYTHON = \
|
|||||||
command/__init__.py \
|
command/__init__.py \
|
||||||
command/command.py
|
command/command.py
|
||||||
|
|
||||||
|
depsdir = $(PYTHONLIBDIR)/morituri/extern/deps
|
||||||
|
|
||||||
|
deps_PYTHON = \
|
||||||
|
deps/__init__.py \
|
||||||
|
deps/deps.py \
|
||||||
|
deps/distro.py
|
||||||
|
|
||||||
|
|
||||||
taskdir = $(PYTHONLIBDIR)/morituri/extern/task
|
taskdir = $(PYTHONLIBDIR)/morituri/extern/task
|
||||||
|
|
||||||
task_PYTHON = \
|
task_PYTHON = \
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ from morituri.extern.task import task
|
|||||||
from morituri.common import logcommand, drive
|
from morituri.common import logcommand, drive
|
||||||
from morituri.program import cdparanoia
|
from morituri.program import cdparanoia
|
||||||
|
|
||||||
|
|
||||||
class Analyze(logcommand.LogCommand):
|
class Analyze(logcommand.LogCommand):
|
||||||
|
|
||||||
summary = "analyze caching behaviour of drive"
|
summary = "analyze caching behaviour of drive"
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ def main(argv):
|
|||||||
log.debug('mapping distributions %r', distributions)
|
log.debug('mapping distributions %r', distributions)
|
||||||
map(pkg_resources.working_set.add, distributions)
|
map(pkg_resources.working_set.add, distributions)
|
||||||
|
|
||||||
|
from morituri.common import deps
|
||||||
|
h = deps.DepsHandler()
|
||||||
|
|
||||||
c = Rip()
|
c = Rip()
|
||||||
try:
|
try:
|
||||||
ret = c.parse(argv)
|
ret = c.parse(argv)
|
||||||
@@ -35,12 +38,12 @@ def main(argv):
|
|||||||
sys.stderr.write('rip: error: %s\n' % e.args)
|
sys.stderr.write('rip: error: %s\n' % e.args)
|
||||||
return 255
|
return 255
|
||||||
except ImportError, e:
|
except ImportError, e:
|
||||||
# FIXME: decide how to handle
|
h.handleImportError(e)
|
||||||
raise
|
|
||||||
# deps.handleImportError(e)
|
|
||||||
# ret = -1
|
|
||||||
except task.TaskException, e:
|
except task.TaskException, e:
|
||||||
if isinstance(e.exception, common.MissingDependencyException):
|
if isinstance(e.exception, ImportError):
|
||||||
|
h.handleImportError(e.exception)
|
||||||
|
return 255
|
||||||
|
elif isinstance(e.exception, common.MissingDependencyException):
|
||||||
sys.stderr.write('rip: error: missing dependency "%s"\n' %
|
sys.stderr.write('rip: error: missing dependency "%s"\n' %
|
||||||
e.exception.dependency)
|
e.exception.dependency)
|
||||||
return 255
|
return 255
|
||||||
|
|||||||
Reference in New Issue
Block a user