Commit 284d8cdd authored by Lukas Tietze's avatar Lukas Tietze

Build-Skripte

parent 0d8b9aae
......@@ -4,6 +4,7 @@
!.vscode/tasks.json
bin/
obj/
__pycache__
*.vcxproj.user
*.spv
......
import commonFunctions
import os
import sys
import shutil
from shutil import get_terminal_size
ColorBlack = "\u001b[30m"
ColorRed = "\u001b[31m"
ColorGreen = "\u001b[32m"
ColorYellow = "\u001b[33m"
ColorBlue = "\u001b[34m"
ColorMagenta = "\u001b[35m"
ColorCyan = "\u001b[36m"
ColorWhite = "\u001b[37m"
ColorReset = "\u001b[0m"
def printInfo(message):
print(ColorBlue, message, ColorReset)
pass
def printWarning(message):
print(ColorYellow, message, ColorReset)
pass
def printError(message):
print(ColorRed, message, ColorReset)
pass
def printStatus(message):
print(ColorCyan, message, ColorReset)
pass
def printSuccess(message):
print(ColorGreen, message, ColorReset)
pass
def beginPart(name):
w = int(get_terminal_size([50, 1]).columns * 0.75)
namePadding = int((w - len(name)) / 2)
printInfo("-" * w)
printInfo((" " * namePadding) + name + (" " * namePadding))
printInfo("-" * w)
pass
def command(cmd) -> int:
printStatus(cmd)
res = os.system(cmd)
str = f"Done, action result: {res}"
if(res == 0):
printSuccess(str)
else:
printWarning(str)
return res
pass
argc = len(sys.argv)
......@@ -91,18 +30,16 @@ if good == 0:
exit()
cmdLatex = "texfot -tee=\".\\tex.fot\" pdflatex -output-format=pdf -interaction=nonstopmode -file-line-error document.tex"
cmdGlossaries = "makeglossaries document"
cmdBib = "bibtex document"
beginPart("Latex first run")
success = command(cmdLatex)
if success == 0:
beginPart("Bibtex")
command(cmdBib)
command("bibtex document")
beginPart("Makeglossaries")
command(cmdGlossaries)
command("makeglossaries document")
beginPart("Latex second run")
success = command(cmdLatex)
......
import os
import subprocess
import sys
from shutil import get_terminal_size
ColorBlack = "\u001b[30m"
ColorRed = "\u001b[31m"
ColorGreen = "\u001b[32m"
ColorYellow = "\u001b[33m"
ColorBlue = "\u001b[34m"
ColorMagenta = "\u001b[35m"
ColorCyan = "\u001b[36m"
ColorWhite = "\u001b[37m"
ColorReset = "\u001b[0m"
def printInfo(message):
print(ColorBlue, message, ColorReset)
pass
def printWarning(message):
print(ColorYellow, message, ColorReset)
pass
def printError(message):
print(ColorRed, message, ColorReset)
pass
def printStatus(message):
print(ColorCyan, message, ColorReset)
pass
def printSuccess(message):
print(ColorGreen, message, ColorReset)
pass
def beginPart(name):
w = int(get_terminal_size([50, 1]).columns * 0.75)
namePadding = int((w - len(name)) / 2)
printInfo("-" * w)
printInfo((" " * namePadding) + name + (" " * namePadding))
printInfo("-" * w)
pass
def command(cmd, input=sys.stdin) -> int:
printStatus(cmd)
res = subprocess.run(cmd, stdin=input)
str = f"Done, action result: {res.returncode}"
if(res.returncode == 0):
printSuccess(str)
else:
printWarning(str)
return res.returncode
pass
from commonFunctions import *
import os
import io
import sys
import subprocess
beginPart("Spell Checking")
dryRun = "-dry" in sys.argv
for root, subdirs, files in os.walk("."):
res = []
for file in files:
if os.path.splitext(file)[1] == ".tex":
filePath = os.path.join(root, file)
if file in sys.argv or filePath in sys.argv:
printWarning("Ignoring file " + filePath)
else:
printInfo("Checking " + filePath)
if not dryRun:
res.append(subprocess.run("aspell --lang=De-de --mode=tex -a",
stdin=io.open(filePath), stdout=io.open("res", "w")))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment