[SCM] morituri/master: use python-deps to handle missing dependencies.

js at users.alioth.debian.org js at users.alioth.debian.org
Sun Oct 19 20:09:56 UTC 2014


The following commit has been merged in the master branch:
commit 6ac8408f0d8a4ee319cdaa3ed247f6147fe13d2e
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sun Jan 27 22:24:22 2013 +0100

    use python-deps to handle missing dependencies.
    
    Apply it to gst python module.

diff --git a/morituri/common/Makefile.am b/morituri/common/Makefile.am
index 1413edf..ce1e3a0 100644
--- a/morituri/common/Makefile.am
+++ b/morituri/common/Makefile.am
@@ -9,6 +9,7 @@ morituri_PYTHON = \
 	cache.py \
 	common.py \
 	config.py \
+	deps.py \
 	directory.py \
 	drive.py \
 	encode.py \
diff --git a/morituri/common/deps.py b/morituri/common/deps.py
new file mode 100644
index 0000000..cd85d8d
--- /dev/null
+++ b/morituri/common/deps.py
@@ -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
diff --git a/morituri/extern/Makefile.am b/morituri/extern/Makefile.am
index f17bc5e..c39716d 100644
--- a/morituri/extern/Makefile.am
+++ b/morituri/extern/Makefile.am
@@ -18,6 +18,14 @@ command_PYTHON = \
 	command/__init__.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
 
 task_PYTHON = \
diff --git a/morituri/rip/drive.py b/morituri/rip/drive.py
index 8aad4cd..eb8229c 100644
--- a/morituri/rip/drive.py
+++ b/morituri/rip/drive.py
@@ -27,7 +27,6 @@ from morituri.extern.task import task
 from morituri.common import logcommand, drive
 from morituri.program import cdparanoia
 
-
 class Analyze(logcommand.LogCommand):
 
     summary = "analyze caching behaviour of drive"
diff --git a/morituri/rip/main.py b/morituri/rip/main.py
index bab3b8c..c4576d1 100644
--- a/morituri/rip/main.py
+++ b/morituri/rip/main.py
@@ -28,6 +28,9 @@ def main(argv):
     log.debug('mapping distributions %r', distributions)
     map(pkg_resources.working_set.add, distributions)
 
+    from morituri.common import deps
+    h = deps.DepsHandler()
+
     c = Rip()
     try:
         ret = c.parse(argv)
@@ -35,12 +38,12 @@ def main(argv):
         sys.stderr.write('rip: error: %s\n' % e.args)
         return 255
     except ImportError, e:
-        # FIXME: decide how to handle
-        raise
-        # deps.handleImportError(e)
-        # ret = -1
+        h.handleImportError(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' %
                 e.exception.dependency)
             return 255

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list