-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathconf.py
More file actions
66 lines (50 loc) · 1.77 KB
/
conf.py
File metadata and controls
66 lines (50 loc) · 1.77 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
"""Sphinx configuration for vcspull documentation."""
from __future__ import annotations
import pathlib
import sys
import typing as t
from gp_sphinx.config import make_linkcode_resolve, merge_sphinx_config
import vcspull
if t.TYPE_CHECKING:
from sphinx.application import Sphinx
# Get the project root dir, which is the parent dir of this
cwd = pathlib.Path(__file__).parent
project_root = cwd.parent
src_root = project_root / "src"
sys.path.insert(0, str(src_root))
sys.path.insert(0, str(cwd / "_ext"))
# package data
about: dict[str, str] = {}
with (src_root / "vcspull" / "__about__.py").open() as fp:
exec(fp.read(), about)
conf = merge_sphinx_config(
project=about["__title__"],
version=about["__version__"],
copyright=about["__copyright__"],
source_repository=f"{about['__github__']}/",
docs_url=about["__docs__"],
source_branch="master",
light_logo="img/vcspull.svg",
dark_logo="img/vcspull-dark.svg",
extra_extensions=[
"sphinx_autodoc_api_style",
"sphinx_argparse_neo.exemplar",
],
intersphinx_mapping={
"py": ("https://docs.python.org/", None),
"libvcs": ("https://libvcs.git-pull.com/", None),
},
linkcode_resolve=make_linkcode_resolve(vcspull, about["__github__"]),
html_favicon="_static/favicon.ico",
html_extra_path=["manifest.json"],
rediraffe_redirects="redirects.txt",
)
_gp_setup = conf.pop("setup")
def setup(app: Sphinx) -> None:
"""Configure Sphinx app hooks and register vcspull-specific lexers."""
_gp_setup(app)
from vcspull_console_lexer import VcspullConsoleLexer
from vcspull_output_lexer import VcspullOutputLexer
app.add_lexer("vcspull-output", VcspullOutputLexer)
app.add_lexer("vcspull-console", VcspullConsoleLexer)
globals().update(conf)