34 lines
841 B
Python
34 lines
841 B
Python
from os import path
|
|
|
|
from sphinx.cmd.build import build_main
|
|
|
|
from rwx.fs import wipe
|
|
from rwx.prj import Project
|
|
|
|
|
|
class SphinxProject(Project):
|
|
def __init__(self, file_path: str) -> None:
|
|
super().__init__(file_path)
|
|
|
|
def build(self):
|
|
output_root: str = path.join(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",
|
|
self.root,
|
|
# "-C",
|
|
path.join(self.root, self.name),
|
|
path.join(output_root, self.name),
|
|
]
|
|
build_main(arguments)
|