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
|
From: Andrey Rakhmatullin <wrar@debian.org>
Date: Thu, 26 Mar 2026 21:50:59 +0500
Subject: Use local intersphinx files.
---
docs/conf.py | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/docs/conf.py b/docs/conf.py
index b7104f3..8c76a3e 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,16 +1,33 @@
+import os, sys
from importlib import metadata
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
]
+def check_object_path(key, url, path):
+ if path and os.path.isfile(path):
+ return {key: (url, path)}
+ return {}
-intersphinx_mapping = {
- 'pytest': ('https://docs.pytest.org/en/stable/', None),
- 'python': ('https://docs.python.org/3/', None),
- 'sphinx': ('https://www.sphinx-doc.org/en/stable/', None),
- 'myst': ('https://myst-parser.readthedocs.io/en/latest', None),
-}
+intersphinx_mapping = {}
+intersphinx_mapping.update(
+ check_object_path('pytest',
+ 'https://docs.pytest.org/en/stable/',
+ '/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('sphinx',
+ 'https://www.sphinx-doc.org/en/stable/',
+ '/usr/share/doc/sphinx-doc/html/objects.inv'))
+intersphinx_mapping.update(
+ check_object_path('myst',
+ 'https://myst-parser.readthedocs.io/en/latest',
+ None)) # the docs are not packaged
# General
source_suffix = '.rst'
|