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
|
From: Michael Fladischer <FladischerMichael@fladi.at>
Date: Sun, 26 Feb 2017 17:19:06 +0100
Subject: Use local objects.inv file for intersphinx.
This makes sure that no online resources are used during package build.
---
docs/source/conf.py | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/docs/source/conf.py b/docs/source/conf.py
index c6fc74f..072920d 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -60,11 +60,29 @@ django.conf.settings.configure(
)
django.setup()
-intersphinx_mapping = {
- 'python': ('http://docs.python.org/3/', None),
- 'django': ('https://docs.djangoproject.com/en/1.11/',
- 'https://docs.djangoproject.com/en/1.11/_objects/'),
-}
+
+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',
+ 'https://docs.python.org/{v}/'.format(
+ v='.'.join(map(str, sys.version_info[0:2]))
+ ),
+ '/usr/share/doc/python{v}/html/objects.inv'.format(
+ v='.'.join(map(str, sys.version_info[0:2]))
+ )
+))
+intersphinx_mapping.update(check_object_path(
+ 'django',
+ 'https://docs.djangoproject.com/en/{v}/'.format(
+ v='.'.join(map(str, django.VERSION[:2]))
+ ),
+ '/usr/share/doc/python-django-doc/html/objects.inv'
+))
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
|