43 lines
1.1 KiB
Python
43 lines
1.1 KiB
Python
"""Project consisting only of a Sphinx documentation."""
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
if TYPE_CHECKING:
|
|
from pathlib import Path
|
|
|
|
from sphinx.cmd.build import build_main
|
|
|
|
from rwx.fs import wipe
|
|
from rwx.prj import Project
|
|
|
|
|
|
class SphinxProject(Project):
|
|
"""Child class for a project based on Sphinx."""
|
|
|
|
def __init__(self, file_path: str) -> None:
|
|
"""Call the parent constructor."""
|
|
super().__init__(file_path)
|
|
|
|
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={}".format("index"),
|
|
"-D",
|
|
"html_theme={}".format("sphinx_rtd_theme"),
|
|
"-c",
|
|
str(self.root),
|
|
# "-C",
|
|
str(self.root / self.name),
|
|
str(output_root / "web"),
|
|
]
|
|
build_main(arguments)
|