()
| 25 | |
| 26 | |
| 27 | def _configure_runtime_tempdir() -> None: |
| 28 | project_root = Path(__file__).resolve().parent.parent |
| 29 | runtime_tmp = Path( |
| 30 | os.getenv("PAPER2ANY_RUNTIME_TMPDIR", str(project_root / "outputs" / "system" / "tmp")) |
| 31 | ).expanduser().resolve() |
| 32 | runtime_tmp.mkdir(parents=True, exist_ok=True) |
| 33 | for key in ("TMPDIR", "TEMP", "TMP"): |
| 34 | os.environ[key] = str(runtime_tmp) |
| 35 | tempfile.tempdir = str(runtime_tmp) |
| 36 | |
| 37 | |
| 38 | _configure_runtime_tempdir() |