[Python-modules-commits] [python-django-otp] 03/08: Use local objects.inv file for intersphinx.
Michael Fladischer
fladi at moszumanska.debian.org
Fri May 12 19:58:55 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 7c4ca5eb3d453f84c47db59fffbf1b652fba716a
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 b7504d0..77cc4fc 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -36,6 +36,7 @@ extensions = [
]
# autodoc and viewcode need valid settings in order to process Django modules.
+import django
import django.conf
django.conf.settings.configure(
DATABASES={
@@ -46,11 +47,28 @@ django.conf.settings.configure(
}
)
-intersphinx_mapping = {
- 'python': ('http://docs.python.org/2/', None),
- 'django': ('https://docs.djangoproject.com/en/1.10/',
- 'https://docs.djangoproject.com/en/1.10/_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