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
|
From: Andrey Rahmatullin <wrar@debian.org>
Date: Sun, 4 Aug 2019 22:38:47 +0500
Subject: Use local intersphinx files.
---
docs/conf.py | 26 ++++++++++++++++++++------
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git a/docs/conf.py b/docs/conf.py
index 77f0d35..5f984f2 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,11 +1,25 @@
# -*- coding: utf-8 -*-
-import os, pkg_resources, datetime, time
+import os, pkg_resources, datetime, time, sys
-intersphinx_mapping = {
- 'python': ('https://docs.python.org/3/', None),
- 'sphinx': ('https://www.sphinx-doc.org/en/stable/', None),
- 'myst': ('https://myst-parser.readthedocs.io/en/latest', None),
-}
+def check_object_path(key, url, path):
+ if path and os.path.isfile(path):
+ return {key: (url, path)}
+ return {}
+
+intersphinx_mapping = {}
+intersphinx_mapping.update(
+ check_object_path('python',
+ 'https://docs.python.org/3/',
+ '/usr/share/doc/python%d.%d/html/objects.inv' % \
+ sys.version_info[:2]))
+intersphinx_mapping.update(
+ check_object_path('sphinx',
+ 'http://www.sphinx-doc.org/en/master/',
+ '/usr/share/doc/sphinx-doc/html/objects.inv'))
+intersphinx_mapping.update(
+ check_object_path('myst',
+ 'https://myst-parser.readthedocs.io/en/latest',
+ None)) # the docs are not packaged
extensions = [
'sphinx.ext.autodoc',
|