Feat: four un peu tout

This commit is contained in:
Bertrand Benjamin 2022-05-07 16:55:33 +02:00
parent 90ae3e936e
commit 8f1d9cb4d4
5 changed files with 31 additions and 14 deletions

View File

@ -2,7 +2,7 @@ import jinja2 as j2
from bopytex.planner.generate_compile_join_planner import planner
from bopytex.worker import Dispatcher
from bopytex.worker.clean import clean
from bopytex.worker.compile import latexmk
from bopytex.worker.compile import pdflatex
from bopytex.worker.generate import generate
from bopytex.worker.join_pdf import pdfjam
@ -11,5 +11,7 @@ jinja2 = {
}
dispatcher = Dispatcher(
{"GENERATE": generate, "COMPILE": latexmk, "JOIN": pdfjam, "CLEAN": clean}
{"GENERATE": generate, "COMPILE": pdflatex, "JOIN": pdfjam, "CLEAN": clean}
)

View File

@ -85,7 +85,7 @@ logger.addHandler(steam_handler)
help="Config file path",
)
def new(**options):
for message in main(options):
for message in main(**options):
try:
assert message.status == 0
except AssertionError:

View File

@ -4,12 +4,22 @@ from bopytex.message import Message
from ..message import SubprocessMessage
def latexmk(args: dict, deps, output):
def curstomtex(command: str, options: str):
def func(args: dict, deps, output) -> Message:
compile_process = subprocess.Popen(
["latexmk", "-f", deps[0]],
[command, options, deps[0]],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True
universal_newlines=True,
)
return Message(
compile_process.wait(),
list(compile_process.stdout),
list(compile_process.stderr),
)
return Message(compile_process.wait(), list(compile_process.stdout), list(compile_process.stderr))
return func
latexmk = curstomtex("latexmk", "-f")
pdflatex = curstomtex("pdflatex", "--inteactions=nonstopmode")

View File

@ -1,6 +1,6 @@
import subprocess
from bopytex.message import SubprocessMessage
from bopytex.message import Message, SubprocessMessage
def pdfjam(args: dict, deps, output):
joining_process = subprocess.Popen(
@ -9,5 +9,10 @@ def pdfjam(args: dict, deps, output):
stderr=subprocess.PIPE,
universal_newlines=True,
)
return SubprocessMessage(joining_process)
#return SubprocessMessage(joining_process)
return Message(
joining_process.wait(),
list(joining_process.stdout),
list(joining_process.stderr),
)

View File

@ -47,7 +47,7 @@ def test_get_config_with_configfile(config_file, tmp_path):
"configfile",
"Dispatcher",
"planner",
"latexmk",
"pdflatex",
"clean",
"j2",
"dispatcher",