Description: Use local object inventory files for sphinx
 Use the local object inventory files to prevent sphinx-build from 
 downloading them during build.
 This patch makes the intersphinx mappings depend on the existence of 
 these files, thus passing Debian Policy 12.3 while still maintaining 
 a level of comfort for the reader of the documentation.
Author: Fladischer Michael <FladischerMichael@fladi.at>
Forwarded: not-needed
Last-Update: 2011-03-03

--- a/doc/conf.py
+++ b/doc/conf.py
@@ -54,8 +54,21 @@
 html_theme = 'default'
 html_static_path = []
 
-intersphinx_mapping = {'python': ('http://docs.python.org/', None),
-                       'sphinx': ('http://sphinx.pocoo.org/', None)}
+def check_object_path(key, url, path):
+    if os.path.isfile(path):
+        return {key: (url, path)}
+    return {}
+
+intersphinx_mapping = {}
+intersphinx_mapping.update(check_object_path('python', 
+                                            'http://docs.python.org/', 
+                                            '/usr/share/doc/python' 
+                                              + '.'.join([str(x) for x in sys.version_info[0:2]]) 
+                                              + '/html/objects.inv'))
+intersphinx_mapping.update(check_object_path('sphinx', 
+                                             'http://sphinx.pocoo.org/', 
+                                             '/usr/share/doc/python-sphinx/html/objects.inv'))
+
 
 issuetracker = 'bitbucket'
 issuetracker_project = 'birkenfeld/sphinx-contrib'
