build.py 1.09 KB
Newer Older
Lukas Tietze's avatar
Lukas Tietze committed
1
from commonFunctions import *
Lukas Tietze's avatar
Lukas Tietze committed
2

Lukas Tietze's avatar
Lukas Tietze committed
3 4
import os
import sys
5
import shutil
Lukas Tietze's avatar
Lukas Tietze committed
6 7 8 9 10 11

argc = len(sys.argv)

good = 1

if argc == 2:
12 13 14 15 16 17 18 19
    workingDir = sys.argv[1]

    if os.path.exists(workingDir):
        os.chdir(sys.argv[1])
        printInfo("Working in %s" % os.getcwd())
    else:
        printError("%s is not a valid working directory" % workingDir)
        good = 0
Lukas Tietze's avatar
Lukas Tietze committed
20
else:
21
    printError("Provide working directory as argument!")
Lukas Tietze's avatar
Lukas Tietze committed
22 23 24
    good = 0

if good == 0:
25 26 27 28
    printWarning("debug: ")

    for x in sys.argv:
        printWarning(x)
Lukas Tietze's avatar
Lukas Tietze committed
29

30
    exit()
Lukas Tietze's avatar
Lukas Tietze committed
31 32 33

cmdLatex = "texfot -tee=\".\\tex.fot\" pdflatex -output-format=pdf -interaction=nonstopmode -file-line-error document.tex"

34 35
beginPart("Latex first run")
success = command(cmdLatex)
Lukas Tietze's avatar
Lukas Tietze committed
36

37 38
if success == 0:
    beginPart("Bibtex")
Lukas Tietze's avatar
Lukas Tietze committed
39
    command("bibtex document")
Lukas Tietze's avatar
Lukas Tietze committed
40

41
    beginPart("Makeglossaries")
Lukas Tietze's avatar
Lukas Tietze committed
42
    command("makeglossaries document")
Lukas Tietze's avatar
Lukas Tietze committed
43

44 45 46 47 48 49 50 51
    beginPart("Latex second run")
    success = command(cmdLatex)

    if success == 0:
        beginPart("Latex final run")
        command(cmdLatex)
    else:
        printError("Stopping after printError")
Lukas Tietze's avatar
Lukas Tietze committed
52
else:
53
    printError("Stopping after printError")