Package: django-auth-ldap / 1.2.2+dfsg-1

docs-use_local_intersphinx_mapping.patch Patch series | 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
36
37
38
39
40
Description: use local objects.inv where possible
 Upstream uses intersphinx mappings that fetch the objects.inv for python and
 python-django by HTTP from a remote host. Using the local objects.inv from
 python and kombu enables the package to build without network connection.
Author: Michael Fladischer <FladischerMichael@fladi.at>
Last-Update: 2013-11-26
Forwarded: not-needed

--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -29,12 +29,23 @@
     'daldocs',
 ]
 
-intersphinx_mapping = {
-    'python': ('http://docs.python.org/', None),
-    'django': ('https://docs.djangoproject.com/en/dev/',
-               'https://docs.djangoproject.com/en/dev/_objects/'),
-    'pythonldap': ('http://python-ldap.org/doc/html/', 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('django',
+                                             'https://docs.djangoproject.com/en/dev/',
+                                             '/usr/share/doc/python-django-doc/html/objects.inv'))
+intersphinx_mapping.update(check_object_path('pythonldap',
+                                             'http://python-ldap.org/doc/html/',
+                                             ''))
 
 # Add any paths that contain templates here, relative to this directory.
 templates_path = ['../_templates']