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
|
From 410cb7aaf03e81be3f2470ee68e3890723db2523 Mon Sep 17 00:00:00 2001
From: Michael Fladischer <FladischerMichael@fladi.at>
Date: Wed, 14 Dec 2016 10:04:52 +0100
Subject: 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 085a773..ca9e3e0 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.
@@ -292,10 +294,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'
+ )
+)
|