File: conf.py

package info (click to toggle)
reuse 5.0.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,316 kB
  • sloc: python: 9,646; makefile: 80; sh: 6; ansic: 5
file content (162 lines) | stat: -rw-r--r-- 4,859 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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# SPDX-FileCopyrightText: 2017 Free Software Foundation Europe e.V. <https://fsfe.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later

# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html


import os
from importlib.metadata import PackageNotFoundError
from importlib.metadata import version as get_version
from pathlib import Path
from shutil import copyfile

DOCS_DIR = Path(os.path.dirname(__file__))
ROOT_DIR = (DOCS_DIR / "..").resolve()

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = "reuse"
copyright = "2017, Free Software Foundation Europe. CC-BY-SA-4.0"
author = "Free Software Foundation Europe"

# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
try:
    # The full version, including alpha/beta/rc tags.
    release = get_version("reuse")
except PackageNotFoundError:
    release = "5.0.2"

# The short X.Y.Z version.
version = ".".join(release.split(".")[:3])

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = "en"

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
    "myst_parser",
    "sphinx.ext.autodoc",
    "sphinx.ext.intersphinx",
    "sphinx.ext.viewcode",
    "sphinx.ext.napoleon",
    "sphinxcontrib.apidoc",
]

templates_path = ["_templates"]
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]

# -- Extensions configuration ------------------------------------------------

apidoc_module_dir = str(ROOT_DIR / "src/reuse")
# apidoc_output_dir = "api"
apidoc_excluded_paths = ["cli"]
apidoc_separate_modules = True
apidoc_toc_file = False
apidoc_extra_args = ["--maxdepth", "2"]

autodoc_member_order = "bysource"

intersphinx_mapping = {"python": ("https://docs.python.org/3", None)}

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = "furo"
html_logo = "reuse-r-only.svg"
html_static_path = ["_static"]

# -- Options for man output --------------------------------------------------
man_pages = [
    (
        "man/reuse",
        "reuse",
        "A tool for compliance with the REUSE recommendations",
        "Free Software Foundation Europe",
        1,
    ),
    (
        "man/reuse-annotate",
        "reuse-annotate",
        "Add REUSE information to files",
        "Free Software Foundation Europe",
        1,
    ),
    (
        "man/reuse-convert-dep5",
        "reuse-convert-dep5",
        "Convert .reuse/dep5 to REUSE.toml",
        "Free Software Foundation Europe",
        1,
    ),
    (
        "man/reuse-download",
        "reuse-download",
        "Download license files",
        "Free Software Foundation Europe",
        1,
    ),
    (
        "man/reuse-lint",
        "reuse-lint",
        "Verify whether a project is compliant with the REUSE Specification",
        "Free Software Foundation Europe",
        1,
    ),
    (
        "man/reuse-lint-file",
        "reuse-lint-file",
        "Verify whether the specified files are compliant with the REUSE"
        " Specification",
        "Free Software Foundation Europe",
        1,
    ),
    (
        "man/reuse-spdx",
        "reuse-spdx",
        "Generate SPDX bill of materials",
        "Free Software Foundation Europe",
        1,
    ),
    (
        "man/reuse-supported-licenses",
        "reuse-supported-licenses",
        "Print a list of supported licenses",
        "Free Software Foundation Europe",
        1,
    ),
]
manpages_url = (
    "https://reuse.readthedocs.io/en/v{version}/man/{page}.html".format(
        version=version, page="{page}"
    )
)

# -- Custom ------------------------------------------------------------------


def copy_markdown(_):
    """Copy the markdown files from the root of the project into the docs/
    directory.
    """
    copyfile(ROOT_DIR / "README.md", DOCS_DIR / "readme.md")
    copyfile(ROOT_DIR / "CHANGELOG.md", DOCS_DIR / "history.md")
    # this used to be renamed to 'contributing.md', but this caused a conflict
    # with the ToC in the README.
    copyfile(ROOT_DIR / "CONTRIBUTING.md", DOCS_DIR / "contribute.md")


def setup(app):
    app.connect("builder-inited", copy_markdown)