From: Sebastian Ramacher <sramacher@debian.org>
Date: Sun, 24 Jan 2021 23:58:10 +0100
Subject: Sphinx documentation tweaks

Instead of including the license verbatim in the documentation, link to
/usr/share/doc/python-libdiscid-doc/copyright. Also use intersphinx-mappings
installed locally.
---
 docs/conf.py     | 19 +++++++++++++++----
 docs/license.rst |  4 ++--
 2 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index f592a10..733cc80 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -175,7 +175,18 @@ extlinks = {
     "musicbrainz": ("http://musicbrainz.org/doc/%s", ""),
 }
 
-intersphinx_mapping = {
-    "python": ("http://docs.python.org/", None),
-    "pydiscid": ("https://python-discid.readthedocs.org/en/latest/", None),
-}
+
+def check_object_path(key, url, path):
+    if os.path.isfile(path):
+        return {key: (url, path)}
+    return {}
+
+
+intersphinx_mapping = {}
+intersphinx_mapping.update(
+    check_object_path(
+        'python',
+        'http://docs.python.org/',
+        '/usr/share/doc/python%d.%d/html/objects.inv' % sys.version_info[:2]
+    )
+)
diff --git a/docs/license.rst b/docs/license.rst
index 2178e22..597390c 100644
--- a/docs/license.rst
+++ b/docs/license.rst
@@ -3,5 +3,5 @@
 License
 -------
 
-.. include:: ../LICENSE
-   :literal:
+The license is available `here
+</usr/share/doc/python-libdiscid-doc/copyright>`_.
