Debian Codegraph @

debian/patches/0001-use-local-objects.inv-where-possible.patch

raw
1 From: Michael Fladischer <[email protected]>
2 Date: Sun, 21 Aug 2016 13:17:22 +0200
3 Subject: use local objects.inv where possible
4
5 Upstream uses intersphinx mappings that fetch the objects.inv for python django
6 through HTTP from a remote host. Using the local objects.inv from python and
7 django enables the package to build without network connection.
8 ---
9 docs/conf.py | 54 +++++++++++++++++++++++++++++++++++++++++++++---------
10 1 file changed, 45 insertions(+), 9 deletions(-)
11
12 diff --git a/docs/conf.py b/docs/conf.py
13 index 28385d1..18d7b74 100644
14 --- a/docs/conf.py
15 +++ b/docs/conf.py
16 @@ -10,6 +10,7 @@
17 # All configuration values have a default; values that are commented out
18 # serve to show the default.
19
20 +import importlib.metadata
21 import os
22 import shutil
23 import sys
24 @@ -276,17 +277,52 @@ texinfo_documents = [
25 # texinfo_show_urls = 'footnote'
26
27
28 +def check_object_path(key, url, path):
29 + if os.path.isfile(path):
30 + return {key: (url, path)}
31 + return {}
32 +
33 +
34 intersphinx_mapping = {
35 - "django": (
36 - "https://docs.djangoproject.com/en/stable",
37 - "https://docs.djangoproject.com/en/stable/_objects/",
38 + **check_object_path(
39 + "django",
40 + "https://docs.djangoproject.com/en/{v}".format(
41 + v=".".join(map(str, django.VERSION[:2]))
42 + ),
43 + "/usr/share/doc/python-django-doc/html/objects.inv",
44 + ),
45 + **check_object_path(
46 + "python",
47 + f"https://docs.python.org/{sys.version_info.major}.{sys.version_info.minor}/",
48 + f"/usr/share/doc/python{sys.version_info.major}.{sys.version_info.minor}/html/objects.inv",
49 + ),
50 + **check_object_path(
51 + "typing-extensions",
52 + "https://typing-extensions.readthedocs.io/en/latest/",
53 + "/usr/share/doc/python-typing-extensions-doc/html/objects.inv",
54 + ),
55 + **check_object_path(
56 + "django-guardian",
57 + "https://django-guardian.readthedocs.io/en/{v}/".format(
58 + v=importlib.metadata.version("django-guardian")
59 + ),
60 + "/usr/share/doc/python3-django-guardian/html/objects.inv",
61 + ),
62 + **check_object_path(
63 + "django-reversion",
64 + "https://django-reversion.readthedocs.io/en/stable",
65 + "/usr/share/doc/python-django-reversion-doc/html/objects.inv",
66 + ),
67 + **check_object_path(
68 + "django-extra-views",
69 + "https://django-extra-views.readthedocs.io/en/stable",
70 + "/usr/share/doc/python-django-extra-views-doc/html/objects.inv",
71 + ),
72 + **check_object_path(
73 + "model-bakery",
74 + "https://model-bakery.readthedocs.io/en/stable",
75 + "/usr/share/doc/python-model-bakery-doc/objects.inv",
76 ),
77 - "python": ("https://docs.python.org/3", None),
78 - "typing-extensions": ("https://typing-extensions.readthedocs.io/en/latest/", None),
79 - "django-guardian": ("https://django-guardian.readthedocs.io/en/stable", None),
80 - "django-reversion": ("https://django-reversion.readthedocs.io/en/stable", None),
81 - "django-extra-views": ("https://django-extra-views.readthedocs.io/en/stable", None),
82 - "model-bakery": ("https://model-bakery.readthedocs.io/en/stable", None),
83 }
84
85 # autodoc settings