Restore checkout venv after apt docs install

This commit is contained in:
Nick Sweeting 2026-07-26 23:37:17 -07:00
parent e617120e8e
commit 1eef0ccaa3
No known key found for this signature in database

View File

@ -435,7 +435,9 @@ def run_snippets(snippet_ids: tuple[str, ...]) -> None:
current_python = ROOT / ".venv" / "bin" / "python"
if not current_python.exists():
current_python = Path(sys.executable)
current_uv = Path(env["UV_BINARY"])
assert current_python.is_file() and os.access(current_python, os.X_OK)
assert current_uv.is_file() and os.access(current_uv, os.X_OK)
checkout_import_root = system_home / "current-checkout"
shutil.copytree(
ROOT / "archivebox",
@ -450,6 +452,9 @@ def run_snippets(snippet_ids: tuple[str, ...]) -> None:
archivebox_wrapper = local_bin_dir / "archivebox"
archivebox_wrapper.write_text(
"#!/usr/bin/env bash\n"
f'if ! {current_python} -c "import rich.panel" >/dev/null 2>&1; then\n'
f" (cd {ROOT} && {current_uv} --no-cache sync --locked --dev >/dev/null)\n"
"fi\n"
f'export PYTHONPATH="{checkout_import_root}${{PYTHONPATH:+:${{PYTHONPATH}}}}"\n'
f'exec {current_python} -m archivebox "$@"\n',
)