From: Andrey Rakhmatullin <wrar@debian.org>
Date: Sat, 20 Apr 2024 22:44:30 +0500
Subject: Use local intersphinx files.

---
 docs/conf.py | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/docs/conf.py b/docs/conf.py
index ceeb2d2..27030d3 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -12,6 +12,7 @@
 # serve to show the default.
 
 import re
+import sys
 from pathlib import Path
 
 # If extensions (or modules to document with autodoc) are in another directory,
@@ -245,7 +246,19 @@ texinfo_documents = [
 
 
 # Example configuration for intersphinx: refer to the Python standard library.
-intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}
+def check_object_path(key, url, path):
+    if path and Path(path).is_file():
+        return {key: (url, path)}
+    return {}
+
+intersphinx_mapping = {}
+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]
+                      )
+)
 
 
 # --- Nitpicking options ------------------------------------------------------
