File: 0002-Make-intersphinx-use-local-copies-of-objects.inv-fil.patch

package info (click to toggle)
python-djangorestframework-simplejwt 5.5.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 956 kB
  • sloc: python: 3,783; makefile: 213; javascript: 40; sh: 6
file content (44 lines) | stat: -rw-r--r-- 1,421 bytes parent folder | download | duplicates (3)
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
From: Michael Fladischer <FladischerMichael@fladi.at>
Date: Fri, 6 Jan 2023 20:59:33 +0000
Subject: Make intersphinx use local copies of objects.inv files.

---
 docs/conf.py | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index f8efc6b..68a232f 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -14,6 +14,8 @@
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
+import os
+import sys
 from pkg_resources import get_distribution
 
 # -- General configuration ------------------------------------------------
@@ -305,9 +307,19 @@ texinfo_documents = [
 
 # -- Intersphinx configuration ------------------------------------------------
 
-intersphinx_mapping = {
-    "python": ("https://docs.python.org/3.8", 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'
+    )
+)
 
 # -- Doctest configuration ----------------------------------------