From: Sebastian Ramacher <sramacher@debian.org>
Date: Thu, 14 Jul 2016 23:01:01 +0200
Subject: Use local intersphinx mappings

Forwarded: not-needed
---
 doc/en/conf.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/doc/en/conf.py b/doc/en/conf.py
index c89e14d..a4b1b86 100644
--- a/doc/en/conf.py
+++ b/doc/en/conf.py
@@ -122,14 +122,17 @@ autodoc_typehints_description_target = "documented"
 # -- Options for intersphinx ----------------------------------------------------------
 # https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html#configuration
 
+def use_if_available(path):
+    return path if os.path.isfile(path) else None
+
 intersphinx_mapping = {
-    "pluggy": ("https://pluggy.readthedocs.io/en/stable", None),
-    "python": ("https://docs.python.org/3", None),
-    "numpy": ("https://numpy.org/doc/stable", None),
+    "pluggy": ("https://pluggy.readthedocs.io/en/stable", use_if_available("/usr/share/doc/python-pluggy/html/objects.inv")),
+    "python": ("https://docs.python.org/3", use_if_available("/usr/share/doc/python3/html/objects.inv")),
+    "numpy": ("https://numpy.org/doc/stable", use_if_available("/usr/share/doc/python-numpy/html/objects.inv")),
     "pip": ("https://pip.pypa.io/en/stable", None),
     "tox": ("https://tox.wiki/en/stable", None),
     "virtualenv": ("https://virtualenv.pypa.io/en/stable", None),
-    "setuptools": ("https://setuptools.pypa.io/en/stable", None),
+    "setuptools": ("https://setuptools.pypa.io/en/stable", use_if_available("/usr/share/doc/python-setuptools-doc/html/objects.inv")),
     "packaging": ("https://packaging.python.org/en/latest", None),
 }
 
