File: 0001-use-local-objects.inv-where-possible.patch

package info (click to toggle)
django-polymorphic 4.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 920 kB
  • sloc: python: 6,782; javascript: 263; makefile: 137
file content (43 lines) | stat: -rw-r--r-- 1,369 bytes parent folder | download | duplicates (2)
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
From: Michael Fladischer <FladischerMichael@fladi.at>
Date: Sun, 21 Aug 2016 13:17:22 +0200
Subject: use local objects.inv where possible

Upstream uses intersphinx mappings that fetch the objects.inv for python django
through HTTP from a remote host. Using the local objects.inv from python and
django enables the package to build without network connection.
---
 docs/conf.py | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 8807ed2..8baec9f 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -269,11 +269,22 @@ texinfo_documents = [
 # texinfo_show_urls = 'footnote'
 
 
-# Example configuration for intersphinx: refer to the Python standard library.
-intersphinx_mapping = {
-    #'http://docs.python.org/': None,
-    "https://docs.djangoproject.com/en/stable": "https://docs.djangoproject.com/en/stable/_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(
+        'django',
+        'https://docs.djangoproject.com/en/{v}'.format(
+            v='.'.join(map(str, django.VERSION[:2]))
+        ),
+        '/usr/share/doc/python-django-doc/html/objects.inv'
+    )
+)
 
 # autodoc settings
 autodoc_member_order = "groupwise"