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

package info (click to toggle)
python-pytest-trio 0.8.0-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 464 kB
  • sloc: python: 944; sh: 49; makefile: 20
file content (51 lines) | stat: -rw-r--r-- 1,368 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
45
46
47
48
49
50
51
From: Michael Fladischer <FladischerMichael@fladi.at>
Date: Sat, 1 Jul 2023 14:41:14 +0000
Subject: Use local objects.inv in intersphinx mapping.

---
 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 7a71ac8..b23d01d 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("../.."))
@@ -71,10 +72,26 @@ extensions = [
     "sphinxcontrib_trio",
 ]
 
-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/',
+        '/usr/share/doc/python' + '.'.join((str(x) for x in sys.version_info[:2])) + '/html/objects.inv'
+    )
+)
+intersphinx_mapping.update(
+    check_object_path(
+        'trio',
+        'https://trio.readthedocs.io/en/v{v}'.format(v=trio.__version__),
+        '/usr/share/doc/python-trio-doc/html/objects.inv'
+    )
+)
 
 autodoc_member_order = "bysource"