From e1eb5693c93ae7841349dbdc1501027dd39047dd Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Mon, 23 Mar 2026 13:16:47 -0700 Subject: [PATCH] split CrawlSetup into Install phase with new Binary + BinaryRequest events --- archivebox/services/runner.py | 6 +++++- archivebox/tests/test_cli_piping.py | 11 ++--------- archivebox/tests/test_runner.py | 4 +++- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/archivebox/services/runner.py b/archivebox/services/runner.py index 6ab96cf4..3f86a214 100644 --- a/archivebox/services/runner.py +++ b/archivebox/services/runner.py @@ -110,7 +110,11 @@ def _installed_binary_config_overrides(plugins: dict[str, Plugin]) -> dict[str, node_modules_dir = node_modules_dir or resolved_path.parent.parent npm_home = npm_home or resolved_path.parent.parent.parent shared_lib_dir = shared_lib_dir or resolved_path.parent.parent.parent.parent - elif resolved_path.parent.name == "bin" and resolved_path.parent.parent.name == "venv" and resolved_path.parent.parent.parent.name == "pip": + elif ( + resolved_path.parent.name == "bin" + and resolved_path.parent.parent.name == "venv" + and resolved_path.parent.parent.parent.name == "pip" + ): pip_bin_dir = pip_bin_dir or resolved_path.parent pip_home = pip_home or resolved_path.parent.parent.parent shared_lib_dir = shared_lib_dir or resolved_path.parent.parent.parent.parent diff --git a/archivebox/tests/test_cli_piping.py b/archivebox/tests/test_cli_piping.py index 9a9eb02a..721f82b3 100644 --- a/archivebox/tests/test_cli_piping.py +++ b/archivebox/tests/test_cli_piping.py @@ -337,11 +337,7 @@ def test_binary_create_stdout_pipes_into_run(initialized_archive): assert create_code == 0, create_stderr _assert_stdout_is_jsonl_only(create_stdout) - binary = next( - record - for record in parse_jsonl_output(create_stdout) - if record.get("type") in {"BinaryRequest", "Binary"} - ) + binary = next(record for record in parse_jsonl_output(create_stdout) if record.get("type") in {"BinaryRequest", "Binary"}) run_stdout, run_stderr, run_code = run_archivebox_cmd( ["run"], @@ -353,10 +349,7 @@ def test_binary_create_stdout_pipes_into_run(initialized_archive): _assert_stdout_is_jsonl_only(run_stdout) run_records = parse_jsonl_output(run_stdout) - assert any( - record.get("type") in {"BinaryRequest", "Binary"} and record.get("id") == binary["id"] - for record in run_records - ) + assert any(record.get("type") in {"BinaryRequest", "Binary"} and record.get("id") == binary["id"] for record in run_records) status = _db_value( initialized_archive, diff --git a/archivebox/tests/test_runner.py b/archivebox/tests/test_runner.py index 5e84dd5d..43b4dcd3 100644 --- a/archivebox/tests/test_runner.py +++ b/archivebox/tests/test_runner.py @@ -318,7 +318,9 @@ def test_installed_binary_config_overrides_include_valid_installed_binaries(monk monkeypatch.setattr( Path, "is_file", - lambda self: str(self) in {sys.executable, mercury_binary.abspath, wget_binary.abspath, puppeteer_binary.abspath, ytdlp_binary.abspath}, + lambda self: ( + str(self) in {sys.executable, mercury_binary.abspath, wget_binary.abspath, puppeteer_binary.abspath, ytdlp_binary.abspath} + ), ) monkeypatch.setattr( runner_module.os,