This commit is contained in:
Marc Beninca 2018-05-10 12:35:55 +02:00
parent f6dc2e8d8d
commit 127ca2e8b9

37
make.py
View file

@ -2,22 +2,33 @@
import os
import shutil
import subprocess
PURGE = ["doctrees"]
FORMATS = {
"html": "html",
# "xelatexpdf": "latex",
"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__":
file = os.path.realpath(__file__)
directory = os.path.dirname(file)
os.chdir(directory)
for build in PURGE + list(FORMATS.values()):
try:
shutil.rmtree(os.path.join("build", build))
except:
pass
for make in reversed(sorted(FORMATS.keys())):
os.system(" ".join(["make", make]))
main()