File: Use-local-inventory-for-intersphinx.patch

package info (click to toggle)
python-django-contact-form 5.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 412 kB
  • sloc: python: 839; makefile: 136
file content (59 lines) | stat: -rw-r--r-- 1,770 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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
From: Carsten Schoenert <c.schoenert@t-online.de>
Date: Fri, 10 Sep 2021 17:15:38 +0200
Subject: Use local inventory for intersphinx

The upstream way is to fetch the interspinx inventary by https from
docs.djangoproject.com.
Using instead the packages stuff from python3-django-doc.

This patch is basicaly completely taken from python-testfixtures and was
written by Michael Fladischer <FladischerMichael@fladi.at>.

Forwarded: not-needed
---
 docs/conf.py | 32 +++++++++++++++++++++++++-------
 1 file changed, 25 insertions(+), 7 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 0659219..1929c91 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -53,13 +53,31 @@ latex_documents = [
     )
 ]
 
-intersphinx_mapping = {
-    "django": (
-        "https://docs.djangoproject.com/en/stable/",
-        "https://docs.djangoproject.com/en/stable/_objects/",
-    ),
-    "python": ("https://docs.python.org/3", 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/{v}/".format(
+            v=".".join(map(str, sys.version_info[0:2]))
+        ),
+        "/usr/share/doc/python{v}/html/objects.inv".format(
+            v=".".join(map(str, sys.version_info[0:2]))
+        )
+    )
+)
+
+intersphinx_mapping.update(
+    check_object_path(
+        "django",
+        "https://django.readthedocs.org/en/latest/",
+        "/usr/share/doc/python-django-doc/html/objects.inv"
+    )
+)
 
 # Spelling check needs an additional module that is not installed by default.
 # Add it only if spelling check is requested so docs can be generated without it.