File size: 1,098 Bytes
932bc69
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Reject new dependency errors while recording known official-image warnings."""
import json
import subprocess
from pathlib import Path


def check(python):
    result = subprocess.run(["/usr/bin/python3", "-m", "pip", "--python", python, "check"], capture_output=True, text=True)
    return [] if result.returncode == 0 else result.stdout.strip().splitlines()


baseline = check("/usr/bin/python3")
accepted = {line for line in baseline if line.startswith(("pygobject ", "nixl "))}
report = {"official_image_errors": baseline, "environments": {}}
for environment in ("/opt/speculators_venv", "/opt/vllm_venv"):
    errors = check(environment + "/bin/python")
    new_errors = sorted(set(errors) - accepted)
    report["environments"][environment] = {"errors": errors, "new_errors": new_errors}
    print(environment + ": " + ("no new dependency errors" if not new_errors else "; ".join(new_errors)))
Path("logs/ngram_setup/dependency-checks.json").write_text(json.dumps(report, indent=2) + "\n")
if any(result["new_errors"] for result in report["environments"].values()):
    raise SystemExit(1)