build.py
This commit is contained in:
parent
384f9001c0
commit
c3af60bbfd
2 changed files with 34 additions and 34 deletions
34
build.py
Executable file
34
build.py
Executable file
|
@ -0,0 +1,34 @@
|
||||||
|
#! /usr/bin/python3 -B
|
||||||
|
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
import sphinx
|
||||||
|
|
||||||
|
INPUT = ["docs"]
|
||||||
|
OUTPUT = "out"
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
file = os.path.realpath(__file__)
|
||||||
|
directory = os.path.dirname(file)
|
||||||
|
output_directory = os.path.join(directory, OUTPUT)
|
||||||
|
shutil.rmtree(output_directory, ignore_errors=True)
|
||||||
|
for doc in INPUT:
|
||||||
|
arguments = [
|
||||||
|
"-E",
|
||||||
|
"-j", "2",
|
||||||
|
"-b", "html",
|
||||||
|
"-D", "project={}".format(doc),
|
||||||
|
"-D", "master_doc={}".format("index"),
|
||||||
|
"-D", "html_theme={}".format("sphinx_rtd_theme"),
|
||||||
|
# "-C",
|
||||||
|
"-c", directory,
|
||||||
|
os.path.join(directory, doc),
|
||||||
|
os.path.join(output_directory, doc),
|
||||||
|
]
|
||||||
|
sphinx.build_main(arguments)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
34
make.py
34
make.py
|
@ -1,34 +0,0 @@
|
||||||
#! /usr/bin/python3 -B
|
|
||||||
|
|
||||||
import os
|
|
||||||
import shutil
|
|
||||||
import subprocess
|
|
||||||
|
|
||||||
FORMATS = {
|
|
||||||
"html": "docs",
|
|
||||||
"latex": "doc",
|
|
||||||
}
|
|
||||||
INPUT = "in"
|
|
||||||
OUTPUT = "out"
|
|
||||||
|
|
||||||
|
|
||||||
def run(*arguments):
|
|
||||||
return subprocess.call(arguments)
|
|
||||||
|
|
||||||
|
|
||||||
def main():
|
|
||||||
script_file = os.path.realpath(__file__)
|
|
||||||
project_directory = os.path.dirname(script_file)
|
|
||||||
os.chdir(project_directory)
|
|
||||||
shutil.rmtree(OUTPUT, ignore_errors=True)
|
|
||||||
for f, name in reversed(sorted(FORMATS.items())):
|
|
||||||
run("sphinx-build",
|
|
||||||
"-b", f,
|
|
||||||
"-c", os.curdir,
|
|
||||||
"-j", "2",
|
|
||||||
"-D", "latex_paper_size=a4",
|
|
||||||
INPUT, os.path.join(OUTPUT, name))
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
main()
|
|
Loading…
Reference in a new issue