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 53 54 55 56 57 58 59 60
|
From: =?utf-8?b?T3R0byBLZWvDpGzDpGluZW4=?= <otto@debian.org>
Date: Thu, 18 Sep 2025 18:59:50 +0000
Subject: Force intersphinx to use local file instead of network
Debian package builds must be reproducible and isolated from external
network access, so prevent the `sphinx.ext.intersphinx` extension from
doing network requests to `docs.python.org` during the documentation
build process.
This fixes the warning seen during the build:
intersphinx inventory 'https://docs.python.org/3.10/objects.inv' not fetchable due to <class 'requests.exceptions.ConnectionError'>: HTTPSConnectionPool(host='docs.python.org', port=443): Max retries exceeded with url: /3.10/objects.inv (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7fda772e97f0>: Failed to resolve 'docs.python.org' ([Errno -3] Temporary failure in name resolution)"))
This does not need to be forwarded as upstream builds likely want to
fetch latest links database over the network on every build.
Forwarded: not-needed
---
docs/conf.py | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/docs/conf.py b/docs/conf.py
index 03725e3..c096b38 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -41,6 +41,21 @@ extensions = [
"sphinx_rtd_theme",
]
+# -- Intersphinx configuration ------------------------------------------------
+
+import os
+
+# Get the absolute path to the intersphinx directory relative to this conf.py
+_intersphinx_cache_path = os.path.abspath(
+ os.path.join(os.path.dirname(__file__), "_build/intersphinx_cache")
+)
+
+intersphinx_mapping = {
+ # Use a local directory for the Python inventory to avoid network access
+ # during build.
+ "python": (_intersphinx_cache_path, None)
+}
+
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
@@ -292,12 +307,6 @@ texinfo_documents = [
# If true, do not generate a @detailmenu in the "Top" node's menu.
# texinfo_no_detailmenu = False
-# -- Intersphinx configuration ------------------------------------------------
-
-intersphinx_mapping = {
- "python": ("https://docs.python.org/3.10", None),
-}
-
# -- Doctest configuration ----------------------------------------
import doctest
|