Description: Update sphinx config to use local inventory
Use local inventory files to generate intersphinx mappings, instead of trying
to access the network during package build.  Based on the patch at
https://sources.debian.org/src/celery/3.1.23-7/debian/patches/intersphinx.patch/
Author: Bill Blough <bblough@debian.org>
Forwarded: not-needed
Last-Update: 2018-08-10
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -348,22 +348,22 @@ texinfo_documents = [
 # texinfo_no_detailmenu = False
 
 # Example configuration for intersphinx: refer to the Python standard library.
-intersphinx_mapping = {
-    "python": ('https://docs.python.org/', None),
-    "django": ('https://docs.djangoproject.com/en/1.9/', 'django.inv'),
-}
+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',
+                                             '/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/1.9/',
+                                             '/usr/share/doc/python-django-doc/html/objects.inv'))
 
 autodoc_member_order = 'bysource'
 
 locale_dirs = ['../test_venv/lib/python2.7/site-packages/django/conf/locale/']
-
-
-def _download_django_inv():
-    import requests
-    with open(_download_django_inv.path, 'w') as f:
-        r = requests.get("https://docs.djangoproject.com/en/1.9/_objects")
-        f.write(r.content)
-_download_django_inv.path = os.path.abspath(os.path.join(os.path.dirname(__file__), "django.inv"))
-
-if not os.path.isfile(_download_django_inv.path):
-    _download_django_inv()
