rtfd/make.py

35 lines
683 B
Python
Raw Normal View History

2017-12-02 21:40:39 +00:00
#! /usr/bin/python3 -B
import os
import shutil
2018-05-10 10:35:55 +00:00
import subprocess
2017-12-02 21:40:39 +00:00
FORMATS = {
2018-05-10 10:35:55 +00:00
"html": "docs",
"latex": "doc",
2017-12-02 21:40:39 +00:00
}
2018-05-10 10:35:55 +00:00
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))
2017-12-02 21:40:39 +00:00
if __name__ == "__main__":
2018-05-10 10:35:55 +00:00
main()