File: handle_missing_packages.patch

package info (click to toggle)
sphinx-issuetracker 0.8-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 316 kB
  • sloc: python: 777; makefile: 131
file content (35 lines) | stat: -rw-r--r-- 1,359 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Description: Handle ImportError more gracefully
 To assist users who do not install the Recommends, enhance the message for 
 ImportError exceptions related to those packages by giving hints on the 
 package names.
Author: Fladischer Michael <FladischerMichael@fladi.at>
Last-Update: 2011-08-26
Forwarded: not-needed

--- a/sphinxcontrib/issuetracker.py
+++ b/sphinxcontrib/issuetracker.py
@@ -160,7 +160,10 @@
 DEBIAN_URL = 'http://bugs.debian.org/cgi-bin/bugreport.cgi?bug={0}'
 
 def lookup_debian_issue(app, tracker_config, issue_id):
-    import debianbts
+    try:
+        import debianbts
+    except ImportError, e:
+        raise ImportError("%s (install package python-debianbts)" % e)
     try:
         # get the bug
         bug = debianbts.get_status(issue_id)[0]
@@ -180,7 +183,10 @@
 def lookup_launchpad_issue(app, tracker_config, issue_id):
     launchpad = getattr(app.env, 'issuetracker_launchpad', None)
     if not launchpad:
-        from launchpadlib.launchpad import Launchpad
+        try:
+            from launchpadlib.launchpad import Launchpad
+        except ImportError, e:
+            raise ImportError("%s (install package python-launchpadlib)" % e)
         launchpad = Launchpad.login_anonymously(
             'sphinxcontrib.issuetracker', service_root='production')
         app.env.issuetracker_launchpad = launchpad