[Python-modules-commits] [python-django-etcd-settings] 08/14: Use local objects.inv files for intersphinx.

Michael Fladischer fladi at moszumanska.debian.org
Wed Dec 14 10:25:29 UTC 2016


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

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

commit dddda3230bedb458533a039b4c5e546aac81287d
Author: Michael Fladischer <FladischerMichael at fladi.at>
Date:   Wed Dec 14 10:04:52 2016 +0100

    Use local objects.inv files for intersphinx.
---
 docs/conf.py | 27 +++++++++++++++++++++------
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index df0fd8e..bdd5eac 100755
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -16,6 +16,8 @@ import sys
 import os
 import shlex
 
+import django
+
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -299,10 +301,23 @@ texinfo_documents = [
 
 
 # Example configuration for intersphinx: refer to the Python standard library.
-intersphinx_mapping = {
-    'https://docs.python.org/': None,
-    'django': (
-        'http://docs.djangoproject.com/en/1.8/',
-        'http://docs.djangoproject.com/en/1.8/_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',
+        'http://docs.python.org/',
+        '/usr/share/doc/python' + '.'.join([str(x) for x in sys.version_info[0:2]]) + '/html/objects.inv'
     )
-}
+)
+intersphinx_mapping.update(
+    check_object_path(
+        'django',
+        'https://docs.djangoproject.com/en/' + django.get_version() + '/',
+        '/usr/share/doc/python-django-doc/html/objects.inv'
+    )
+)

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



More information about the Python-modules-commits mailing list