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

package info (click to toggle)
python-sniffio 1.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 236 kB
  • sloc: python: 185; sh: 44; makefile: 19
file content (47 lines) | stat: -rw-r--r-- 1,325 bytes parent folder | download | duplicates (2)
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
From: Michael Fladischer <FladischerMichael@fladi.at>
Date: Tue, 7 Nov 2023 16:04:41 +0000
Subject: Use local objects.inv in intersphinx mapping.

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

diff --git a/docs/source/conf.py b/docs/source/conf.py
index 7fb30ff..2332045 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -19,6 +19,7 @@
 #
 import os
 import sys
+import trio
 # So autodoc can import our package
 sys.path.insert(0, os.path.abspath('../..'))
 
@@ -51,6 +52,26 @@ intersphinx_mapping = {
     "python": ('https://docs.python.org/3', None),
     "trio": ('https://trio.readthedocs.io/en/stable', 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.major}.{v.minor}'.format(v=sys.version_info),
+        '/usr/share/doc/python{v.major}.{v.minor}/html/objects.inv'.format(v=sys.version_info)
+    )
+)
+intersphinx_mapping.update(
+    check_object_path(
+        'trio',
+        f'https://trio.readthedocs.io/en/v{trio.__version__}/',
+        '/usr/share/doc/python-trio-doc/html/objects.inv'
+    )
+)
 
 autodoc_member_order = "bysource"