39 lines
926 B
Python
39 lines
926 B
Python
"""Project consisting only of a Sphinx documentation."""
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
from sphinx.cmd.build import build_main
|
|
|
|
from rwx.fs import wipe
|
|
from rwx.prj import Project
|
|
|
|
if TYPE_CHECKING:
|
|
from pathlib import Path
|
|
|
|
|
|
class SphinxProject(Project):
|
|
"""Child class for a project based on Sphinx."""
|
|
|
|
def build(self) -> None:
|
|
"""Build the project."""
|
|
output_root: Path = self.root / "out"
|
|
wipe(output_root)
|
|
arguments: list[str] = [
|
|
"-E",
|
|
"-j",
|
|
"2",
|
|
"-b",
|
|
"html",
|
|
"-D",
|
|
f"project={self.name}",
|
|
"-D",
|
|
"master_doc=index",
|
|
"-D",
|
|
"html_theme=sphinx_rtd_theme",
|
|
"-c",
|
|
str(self.root),
|
|
# "-C",
|
|
str(self.root / self.name),
|
|
str(output_root / "web"),
|
|
]
|
|
build_main(arguments)
|