File: 0001-Use-local-intersphinx-files.patch

package info (click to toggle)
python-w3lib 2.3.1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 396 kB
  • sloc: python: 3,141; makefile: 133
file content (60 lines) | stat: -rw-r--r-- 1,719 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
60
From: Andrey Rakhmatullin <wrar@wrar.name>
Date: Sun, 21 Apr 2024 23:09:16 +0500
Subject: Use local intersphinx files.

---
 docs/conf.py | 41 ++++++++++++++++++++++++++++++++++-------
 1 file changed, 34 insertions(+), 7 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 1384d74..b65502e 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -249,13 +249,40 @@ texinfo_documents = [
 
 
 # Example configuration for intersphinx: refer to the Python standard library.
-intersphinx_mapping = {
-    "pytest": ("https://docs.pytest.org/en/latest", None),
-    "python": ("https://docs.python.org/3", None),
-    "scrapy": ("https://docs.scrapy.org/en/latest", None),
-    "tox": ("https://tox.wiki/en/latest", None),
-}
-
+def check_object_path(key, url, path):
+    if path and os.path.isfile(path):
+        return {key: (url, path)}
+    return {}
+
+intersphinx_mapping = {}
+intersphinx_mapping.update(
+    check_object_path(
+        "pytest",
+        "https://docs.pytest.org/en/latest",
+        "/usr/share/doc/python-pytest-doc/html/objects.inv",
+    )
+)
+intersphinx_mapping.update(
+    check_object_path(
+        "python",
+        "https://docs.python.org/3",
+        "/usr/share/doc/python%d.%d/html/objects.inv" % sys.version_info[:2],
+    )
+)
+intersphinx_mapping.update(
+    check_object_path(
+        "scrapy",
+        "https://scrapy.readthedocs.io/en/latest",
+        "/usr/share/doc/python-scrapy-doc/html/objects.inv",
+    )
+)
+intersphinx_mapping.update(
+    check_object_path(
+        "tox",
+        "https://tox.wiki/en/latest/",
+        "/usr/share/doc/tox/html/objects.inv",
+    )
+)
 
 # -- Nitpicking options -------------------------------------------------------