cnam.marc/cnam/travaux/blanc/build.py

37 lines
639 B
Python
Raw Normal View History

2020-04-22 18:56:05 +02:00
#! /usr/bin/python3 -B
import os
import subprocess
DOCUMENTS = [
'document',
'présentation',
]
def build():
for document in DOCUMENTS:
command = ['xelatex', f'{document}.tex']
for _ in range(2):
subprocess.call(command)
def clean():
_, _, files = next(os.walk(directory))
for file in files:
name, ext = os.path.splitext(file)
2020-04-22 19:15:19 +02:00
if ext in ['.aux', '.log', '.toc']:
2020-04-22 18:56:05 +02:00
os.remove(file)
def main():
file = os.path.realpath(__file__)
directory = os.path.dirname(file)
os.chdir(directory)
build()
clean()
if __name__ == '__main__':
main()