Prepare sections, build zip, and compile PDF after a successful run.
(run: RunState)
| 401 | |
| 402 | |
| 403 | def _post_process(run: RunState) -> None: |
| 404 | """Prepare sections, build zip, and compile PDF after a successful run.""" |
| 405 | sections_dir = Path(run.workspace_output_dir) / "writer" / "sections" |
| 406 | artefact_dir = HOST_OUTPUTS_DIR / run.task_name / "artefacts" |
| 407 | artefact_dir.mkdir(parents=True, exist_ok=True) |
| 408 | |
| 409 | # Step 1: Zip the sections directory + PRIMEarxiv.sty |
| 410 | zip_path = artefact_dir / "proposal_sources.zip" |
| 411 | _build_zip(sections_dir, zip_path) |
| 412 | run.zip_path = str(zip_path) |
| 413 | print(f"[POST] ZIP created: {zip_path}") |
| 414 | |
| 415 | # Step 2: Compile PDF |
| 416 | pdf_tmp = _compile_pdf(sections_dir) |
| 417 | if pdf_tmp: |
| 418 | pdf_dest = artefact_dir / "proposal.pdf" |
| 419 | shutil.copy2(pdf_tmp, pdf_dest) |
| 420 | run.pdf_path = str(pdf_dest) |
| 421 | print(f"[POST] PDF saved: {pdf_dest}") |
| 422 | try: |
| 423 | shutil.rmtree(pdf_tmp.parent, ignore_errors=True) |
| 424 | except Exception: |
| 425 | pass |
| 426 | else: |
| 427 | print("[POST] PDF compilation failed or main.tex missing.") |
| 428 | |
| 429 | |
| 430 | # --------------------------------------------------------------------------- |
no test coverage detected