Feat: Add test! snippet compilation failed thow...
This commit is contained in:
@@ -2,7 +2,8 @@
|
||||
# encoding: utf-8
|
||||
|
||||
|
||||
__version__ = "0.1"
|
||||
from .bopytex import produce_and_compile
|
||||
|
||||
|
||||
# -----------------------------
|
||||
# Reglages pour 'vim'
|
||||
|
||||
@@ -100,7 +100,11 @@ def pdfjoin(pdf_files, destname, working_dir=".", rm_pdfs=1):
|
||||
|
||||
|
||||
def extract_student_csv(csv_filename):
|
||||
""" Extract student list from csv_filename """
|
||||
""" Extract student list from csv_filename
|
||||
|
||||
Student identifier is got in the column "Élève".
|
||||
|
||||
"""
|
||||
with open(csv_filename, "r") as csvfile:
|
||||
reader = csv.DictReader(csvfile)
|
||||
return [r["Élève"] for r in reader]
|
||||
@@ -113,7 +117,7 @@ def produce_and_compile(options):
|
||||
|
||||
if options["only_corr"]:
|
||||
options["corr"] = True
|
||||
tex_files = working_dir.files("[0-9]*_*.tex")
|
||||
tex_files = working_dir.glop("[0-9]*_*.tex")
|
||||
else:
|
||||
template = Path(options["template"]).name
|
||||
logger.debug(f"Template will be {template}")
|
||||
@@ -152,16 +156,16 @@ def produce_and_compile(options):
|
||||
)
|
||||
logger.debug(f"{dest} fed")
|
||||
|
||||
if not options["no_compil"]:
|
||||
if not options["no_compile"]:
|
||||
pdf_files = []
|
||||
for texfile in tex_files:
|
||||
logger.debug(f"Start compiling {texfile}")
|
||||
pytex.pdflatex(texfile)
|
||||
logger.debug(f"End compiling {texfile}")
|
||||
pdf_files.append(str(texfile[:-4] + ".pdf"))
|
||||
pdf_files.append(str(texfile).split('.')[0] + ".pdf")
|
||||
logger.debug(f"Compiled files : {pdf_files}")
|
||||
|
||||
if not options["no_join"] and not options["no_compil"]:
|
||||
if not options["no_join"] and not options["no_compile"]:
|
||||
pdfjoin(
|
||||
pdf_files,
|
||||
template.replace("tpl", "all").replace(".tex", ".pdf"),
|
||||
@@ -173,14 +177,14 @@ def produce_and_compile(options):
|
||||
pdf_files = []
|
||||
for texfile in tex_files:
|
||||
corr_fname = activate_printanswers(texfile)
|
||||
if not options["no_compil"]:
|
||||
if not options["no_compile"]:
|
||||
logger.debug(f"Start compiling {texfile}")
|
||||
pytex.pdflatex(corr_fname)
|
||||
logger.debug(f"End compiling {texfile}")
|
||||
pdf_files.append(str(corr_fname[:-4] + ".pdf"))
|
||||
pdf_files.append(str(corr_fname).split(".")[0] + ".pdf")
|
||||
deactivate_printanswers(corr_fname)
|
||||
|
||||
if not options["no_join"] and not options["no_compil"]:
|
||||
if not options["no_join"] and not options["no_compile"]:
|
||||
pdfjoin(
|
||||
pdf_files,
|
||||
template.replace("tpl", "corr").replace(".tex", ".pdf"),
|
||||
|
||||
Reference in New Issue
Block a user