compilation des versions en parallèle

Cette révision appartient à :
Yann Salmon
2019-03-12 11:58:02 +01:00
Parent fd630265c8
révision a8179d6a58

Voir le fichier

@@ -4,13 +4,24 @@ import subprocess
import sys import sys
import os import os
def compiler(nf, suff) : def compiler(nf, lsuff) :
basedir = os.path.dirname(nf) basedir = os.path.dirname(nf)
builddir = os.path.join(basedir, "_build") builddir = os.path.join(basedir, "_build")
basejobname = os.path.splitext(os.path.basename(nf))[0] basejobname = os.path.splitext(os.path.basename(nf))[0]
options = suff[1] # https://stackoverflow.com/a/9745864
subprocess.call('''latexmk -pdflua -shell-escape -bibtex-cond -cd -interaction=batchmode -dvi- -jobname=''' +basejobname+suff[0] +''' -outdir=''' + builddir + ''' -latexoption="--output-directory='''+builddir+''' --synctex=0 ''' + options + '''" ''' + nf, shell=True) processes = []
os.rename(os.path.join(builddir, basejobname+suff[0]+".pdf"), os.path.join(basedir, basejobname+suff[0]+".pdf")) for suff in lsuff :
options = suff[1]
processes.append(subprocess.Popen('''latexmk -pdflua -shell-escape -bibtex-cond -cd -interaction=batchmode -dvi- -jobname=''' +basejobname+suff[0] +''' -outdir=''' + builddir + ''' -latexoption="--output-directory='''+builddir+''' --synctex=0 ''' + options + '''" ''' + nf, shell=True, stdout=subprocess.PIPE,
bufsize=1, close_fds=True,
universal_newlines=True))
while len(processes) > 0 :
for p in processes:
if p.poll() is not None: # process ended
p.stdout.close()
processes.remove(p)
for suff in lsuff :
os.rename(os.path.join(builddir, basejobname+suff[0]+".pdf"), os.path.join(basedir, basejobname+suff[0]+".pdf"))
@@ -36,7 +47,5 @@ with open(nf) as f :
break break
compiler(nf, modes)
for suff in modes :
compiler(nf, suff)