make
This commit is contained in:
parent
f6dc2e8d8d
commit
127ca2e8b9
1 changed files with 24 additions and 13 deletions
37
make.py
37
make.py
|
@ -2,22 +2,33 @@
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
|
||||||
PURGE = ["doctrees"]
|
|
||||||
FORMATS = {
|
FORMATS = {
|
||||||
"html": "html",
|
"html": "docs",
|
||||||
# "xelatexpdf": "latex",
|
"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__":
|
if __name__ == "__main__":
|
||||||
file = os.path.realpath(__file__)
|
main()
|
||||||
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]))
|
|
||||||
|
|
Loading…
Reference in a new issue