[Python-modules-commits] [python-django-otp] 03/07: Use local objects.inv file for intersphinx.

Michael Fladischer fladi at moszumanska.debian.org
Sat Jul 22 13:30:39 UTC 2017


This is an automated email from the git hooks/post-receive script.

fladi pushed a commit to branch master
in repository python-django-otp.

commit 0b6866e4bfe367cbe52aaf80b30bf11511d2a4c4
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Sun Feb 26 17:19:06 2017 +0100

    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 73d0c10..0b183fa 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']

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-django-otp.git



More information about the Python-modules-commits mailing list