-
Notifications
You must be signed in to change notification settings - Fork 4
/
compile.py
31 lines (27 loc) · 816 Bytes
/
compile.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import subprocess, sys, os, time
def main():
files = ['dissertation']
for file in files:
clean(file)
compile(file)
# Wait a bit so that all files that will be dropped have been created
time.sleep(3)
clean(file)
def compile(file):
commands = [
['pdflatex', file + '.tex'],
['biber', file],
['pdflatex', file + '.tex'],
['pdflatex', file + '.tex']
]
for c in commands:
subprocess.call(c)
def clean(file):
suffixes = ('aux', 'bbl', 'bcf', 'blg', 'fdb_latexmk', 'fls', 'log', 'out', 'run.xml', 'synctex.gz', 'toc')
for suffix in suffixes:
try:
os.remove(str(file) + '.' + suffix)
except FileNotFoundError:
continue
if __name__ == "__main__":
main()