File: 0002-Use-local-objects.inv-in-intersphinx-mapping.patch

package info (click to toggle)
python-ldap 3.4.4-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,368 kB
  • sloc: python: 9,558; ansic: 3,052; makefile: 139; sh: 79
file content (30 lines) | stat: -rw-r--r-- 996 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
From: Michael Fladischer <fladi@debian.org>
Date: Sun, 7 Aug 2022 12:48:29 +0000
Subject: Use local objects.inv in intersphinx mapping.

---
 Doc/conf.py | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/Doc/conf.py b/Doc/conf.py
index b883736..ab4eafa 100644
--- a/Doc/conf.py
+++ b/Doc/conf.py
@@ -153,4 +153,16 @@ latex_documents = [('index', 'python-ldap.tex', 'python-ldap Documentation',
 # If false, no module index is generated.
 latex_use_modindex = True
 
-intersphinx_mapping = {'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/' + '.'.join([str(x) for x in sys.version_info[0:2]]),
+        '/usr/share/doc/python' + '.'.join([str(x) for x in sys.version_info[0:2]]) + '/html/objects.inv'
+    )
+)