[Python-modules-commits] [python-testfixtures] 03/08: Use local objects.inv where possible

Michael Fladischer fladi at moszumanska.debian.org
Thu Jun 1 14:07:16 UTC 2017


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

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

commit d51fe5544dab8a41907e32f3f73a4a0dc3951c04
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Fri Jan 27 09:50:38 2017 +0100

    Use local objects.inv where possible
    
    Upstream uses intersphinx mappings that fetch the objects.inv for python by
    HTTP from a remote host. Using the local objects.inv from python enables the
    package to build without network connection.
---
 docs/conf.py | 27 +++++++++++++++++++++++----
 1 file changed, 23 insertions(+), 4 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 7a3cef7..7b44b46 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -4,6 +4,7 @@ import os
 import pkginfo
 import sys
 import time
+import django
 
 on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
 pkg_info = pkginfo.Develop(os.path.join(os.path.dirname(__file__), '..'))
@@ -14,10 +15,28 @@ extensions = [
     'sphinx.ext.intersphinx'
     ]
 
-intersphinx_mapping = {
-    'http://docs.python.org': None,
-    'http://django.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',
+    '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'
+))
 
 # General
 source_suffix = '.txt'

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



More information about the Python-modules-commits mailing list