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

package info (click to toggle)
python-itemloaders 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 312 kB
  • sloc: python: 1,497; makefile: 78
file content (48 lines) | stat: -rw-r--r-- 1,612 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
From: Andrey Rakhmatullin <wrar@wrar.name>
Date: Fri, 19 Apr 2024 00:04:58 +0500
Subject: Use local intersphinx files.

---
 docs/conf.py | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 9a22021..9048152 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -10,6 +10,7 @@
 # All configuration values have a default; values that are commented out
 # serve to show the default.
 
+import os
 import sys
 from pathlib import Path
 
@@ -216,8 +217,22 @@ def maybe_skip_member(app, what, name, obj, skip, options):
 
 nitpicky = True
 
-intersphinx_mapping = {
-    "parsel": ("https://parsel.readthedocs.io/en/stable/", None),
-    "python": ("https://docs.python.org/3", None),
-    "scrapy": ("https://docs.scrapy.org/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('parsel',
+                      'https://parsel.readthedocs.io/en/stable/',
+                      '/usr/share/doc/python-parsel-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://docs.scrapy.org/en/latest/',
+                      '/usr/share/doc/python-scrapy-doc/html/objects.inv'))