Package: python-django-treebeard / 4.3.1+dfsg-1

0002-Make-intersphinx-use-local-copies-of-objects.inv-fil.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
41
From: Michael Fladischer <fladi@debian.org>
Date: Wed, 30 Dec 2015 20:43:47 +0100
Subject: Make intersphinx use local copies of objects.inv files.

---
 docs/source/conf.py | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/docs/source/conf.py b/docs/source/conf.py
index a999d36..6c3e0f3 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -297,7 +297,24 @@ texinfo_documents = [
 # If true, do not generate a @detailmenu in the "Top" node's menu.
 #texinfo_no_detailmenu = False
 
-intersphinx_mapping = {
-    'django': ('https://docs.djangoproject.com/en/stable/', 'https://docs.djangoproject.com/en/stable/_objects/'),
-    'python': ('https://docs.python.org/3.5', 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',
+        'https://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/' + django.get_version() + '/',
+        '/usr/share/doc/python-django-doc/html/objects.inv'
+    )
+)
+