Esempio n. 1
0
def update_compilation_log(
    output_dir_key: str,
    arxiv_id: ArxivId,
    stdout: bytes,
    source_path: RelativePath,
    success: bool,
) -> None:

    arxiv_id_output_root = directories.arxiv_subdir(output_dir_key, arxiv_id)
    results_path = os.path.join(arxiv_id_output_root, "compilation_results.csv")

    missing_driver = is_driver_unimplemented(stdout)
    errors = list(get_errors(stdout))
    if missing_driver:
        logging.warning(  # pylint: disable=logging-not-lazy
            "Could not compile arXiv ID %s because colorization commands are missing for the"
            + "driver needed to compile that TeX project.",
            arxiv_id,
        )

    # Write the compilation result to the log.
    file_utils.append_to_csv(
        results_path,
        CompilationSummaryEntry(
            outcome="SUCCESS" if success else "FAILURE",
            source_path=source_path,
            missing_driver=missing_driver,
            errors=[e.decode("utf-8", "ignore") for e in errors],
        ),
    )
Esempio n. 2
0
def test_is_not_missing_driver():
    stdout = bytearray(
        "(./main.tex\n" +
        "Output written on main.pdf (1 page, 11340 bytes).\n" +
        "Transcript written on main.log.",
        "utf-8",
    )
    assert not is_driver_unimplemented(stdout)
Esempio n. 3
0
def test_is_missing_driver():
    stdout = bytearray(
        "[Loading MPS to PDF converter (version 2006.09.02).]\n" +
        ")))) Coloring not implemented for driver luatex.def\n" +
        "Coloring not implemented for driver luatex.def)",
        "utf-8",
    )
    assert is_driver_unimplemented(stdout)