This repository was archived by the owner on Apr 19, 2024. It is now read-only.
forked from xmlsec/python-xmlsec
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconf.py
More file actions
96 lines (76 loc) · 2.7 KB
/
conf.py
File metadata and controls
96 lines (76 loc) · 2.7 KB
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
93
94
95
96
# -*- coding: utf-8 -*-
import sys
import urllib.request
import lxml
from docutils.nodes import reference
from packaging.version import parse
from sphinx.errors import ExtensionError
if sys.version_info >= (3, 8):
from importlib import metadata as importlib_metadata
else:
import importlib_metadata
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.viewcode', 'sphinx.ext.intersphinx']
intersphinx_mapping = {'python': ('https://docs.python.org/3/', None)}
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
project = u'python-xmlsec'
copyright = u'2020, Oleg Hoefling <oleg.hoefling@gmail.com>'
author = u'Bulat Gaifullin <gaifullinbf@gmail.com>'
release = importlib_metadata.version('xmlsec')
parsed = parse(release)
version = '{}.{}'.format(parsed.major, parsed.minor)
language = None
exclude_patterns = []
pygments_style = 'sphinx'
todo_include_todos = False
html_theme = 'furo'
html_static_path = []
htmlhelp_basename = 'python-xmlsecdoc'
latex_elements = {}
latex_documents = [
(
master_doc,
'python-xmlsec.tex',
u'python-xmlsec Documentation',
u'Bulat Gaifullin \\textless{}gaifullinbf@gmail.com\\textgreater{}',
'manual',
)
]
man_pages = [(master_doc, 'python-xmlsec', u'python-xmlsec Documentation', [author], 1)]
texinfo_documents = [
(
master_doc,
'python-xmlsec',
u'python-xmlsec Documentation',
author,
'python-xmlsec',
'One line description of project.',
'Miscellaneous',
)
]
autodoc_member_order = 'groupwise'
autodoc_docstring_signature = True
# LXML crossref'ing stuff:
# LXML doesn't have an intersphinx docs,
# so we link to lxml.etree._Element explicitly
lxml_element_cls_doc_uri = 'https://lxml.de/api/lxml.etree._Element-class.html'
def lxml_element_doc_reference(app, env, node, contnode):
"""
Handle a missing reference only if it is a ``lxml.etree._Element`` ref.
We handle only :class:`lxml.etree._Element` and :class:`~lxml.etree._Element` nodes.
"""
if (
node.get('reftype', None) == 'class'
and node.get('reftarget', None) == 'lxml.etree._Element'
and contnode.astext() in ('lxml.etree._Element', '_Element')
):
reftitle = '(in lxml v{})'.format(lxml.__version__)
newnode = reference('', '', internal=False, refuri=lxml_element_cls_doc_uri, reftitle=reftitle)
newnode.append(contnode)
return newnode
def setup(app):
# first, check whether the doc URL is still valid
if urllib.request.urlopen(lxml_element_cls_doc_uri).getcode() != 200:
raise ExtensionError('URL to `lxml.etree._Element` docs is not accesible.')
app.connect('missing-reference', lxml_element_doc_reference)