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

package info (click to toggle)
django-polymorphic 1.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 648 kB
  • ctags: 887
  • sloc: python: 3,712; makefile: 142
file content (39 lines) | stat: -rw-r--r-- 1,715 bytes parent folder | download
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
From 4a90ce165efb82deb0dc6517fe6165016f86f7d9 Mon Sep 17 00:00:00 2001
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 | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index f14fa5f..e826275 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -249,8 +249,17 @@ 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/dev': 'https://docs.djangoproject.com/en/dev/_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/dev',
+                                             '/usr/share/doc/python-django-doc/html/objects.inv'))