split CrawlSetup into Install phase with new Binary + BinaryRequest events

This commit is contained in:
Nick Sweeting
2026-03-23 13:16:47 -07:00
parent 25f935b9d1
commit e1eb5693c9
3 changed files with 10 additions and 11 deletions

View File

@@ -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

View File

@@ -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,

View File

@@ -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,