File: 0001-Use-local-objects.inv-in-intersphinx-mapping.patch

package info (click to toggle)
python-django-celery-beat 2.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,112 kB
  • sloc: python: 3,440; makefile: 319; sh: 22
file content (92 lines) | stat: -rw-r--r-- 2,854 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
From: Michael Fladischer <FladischerMichael@fladi.at>
Date: Mon, 27 Jun 2022 06:31:01 +0000
Subject: Use local objects.inv in intersphinx mapping.

---
 docs/conf.py | 59 +++++++++++++++++++++++++++++++++++++++++++++++------------
 1 file changed, 47 insertions(+), 12 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index 36d4d8e..7284de1 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,7 +1,53 @@
 import os
+import sys
+import django
+import celery
 
 from sphinx_celery import conf
 
+
+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[:2])) + '/html/objects.inv'
+    )
+)
+intersphinx_mapping.update(
+    check_object_path(
+        'sphinx',
+        'https://www.sphinx-doc.org/en/master/',
+        '/usr/share/doc/sphinx-doc/html/objects.inv'
+    )
+)
+intersphinx_mapping.update(
+    check_object_path(
+        'django',
+        'https://docs.djangoproject.com/en/' + '.'.join((str(c) for c in django.VERSION[:2])) + '/_objects/',
+        '/usr/share/doc/python-django-doc/html/objects.inv'
+    )
+)
+intersphinx_mapping.update(
+    check_object_path(
+        'celery',
+        'https://docs.celeryq.dev/en/' + '.'.join((str(c) for c in celery.VERSION[:3])) + '/',
+        '/usr/share/doc/python-celery-doc/html/objects.inv'
+    )
+)
+intersphinx_mapping.update(
+    check_object_path(
+        'django-celery-results',
+        'https://django-celery-results.readthedocs.io/en/latest/',
+        '/usr/share/doc/python-django-celery-results-doc/html/objects.inv'
+    )
+)
+
 globals().update(conf.build_config(
     'django_celery_beat', __file__,
     project='django_celery_beat',
@@ -12,7 +58,7 @@ globals().update(conf.build_config(
     github_project='celery/django-celery-beat',
     copyright='2016',
     django_settings='proj.settings',
-    include_intersphinx={'python', 'sphinx', 'django', 'celery'},
+    intersphinx_mapping=intersphinx_mapping,
     path_additions=[os.path.join(os.pardir, 't')],
     html_logo='images/logo.png',
     html_favicon='images/favicon.ico',
@@ -31,16 +77,5 @@ globals().update(conf.build_config(
             'GitHub PR #%s',
         ),
     },
-    extra_intersphinx_mapping={
-        'django-celery-results': (
-            'https://django-celery-results.readthedocs.io/en/latest/',
-            None
-        ),
-    },
     extensions=['sphinxcontrib_django']
 ))
-
-intersphinx_mapping = globals().get('intersphinx_mapping', {})
-intersphinx_mapping['celery'] = (
-    'https://celery.readthedocs.io/en/main/', None)
-globals().update({'intersphinx_mapping': intersphinx_mapping})