← Commit history

Delete tools/route_live.py

John Lauer ·1a6eb1c170 ·2d ago ·parent 6676e65
1 file changed −41
tools/route_live.pydeleted−41
@@ -1,41 +0,0 @@-#!/usr/bin/env python3-"""Hand routes on the live KiCad board through Adom Bridge: dry-run each, commit only on 0 DRC errors,-chain the revision. Usage: route_live.py <routes.json>   (revision read/written in $REV_FILE)--routes.json: [{"name":..., "net":..., "width":..., "paths":[[...]], "viaSize"?:..., "viaDrill"?:...}, ...]-"""-import json, os, subprocess, sys--BOARD = os.environ.get("BOARD", "C:/Users/john/Documents/buck-12v5v-molecule/kicad/buck-12v5v-molecule.kicad_pcb")-TARGET = os.environ.get("TARGET", "ConfRoomROG")-REV_FILE = os.environ["REV_FILE"]---def call(args):-    r = subprocess.run(["adom-bridge", "--target", TARGET, "kicad_route_net", json.dumps(args), "--ai-thread", "buck-repro"],-                       capture_output=True, text=True)-    d = json.loads(r.stdout); o = d.get("output", d)-    return json.loads(o) if isinstance(o, str) and o.startswith("{") else o---rev = open(REV_FILE).read().strip()-for rt in json.load(open(sys.argv[1])):-    args = {k: rt[k] for k in ("net", "width", "paths", "viaSize", "viaDrill") if k in rt}-    args.update(filePath=BOARD, expectedRevision=rev, reason=f"hand route: {rt['name']}")-    dry = call(dict(args, dryRun=True))-    drc = dry.get("drc", {}) or {}-    errs = drc.get("errors")-    new = [v for v in (drc.get("newViolations") or []) if v.get("severity") == "error"]-    if not dry.get("success") or errs:-        print(f"DRY FAIL {rt['name']}: {dry.get('errorCode')} {dry.get('error') or ''} errors={errs}")-        for v in (dry.get("violations") or drc.get("violations") or (drc.get("summary", {}).get("first")) or [])[:8]:-            if v.get("severity") == "error":-                print("   ", v.get("type"), "|", v.get("description"), "|", [i.get("description") if isinstance(i, dict) else i for i in v.get("items", [])])-        sys.exit(1)-    live = call(args)-    if not live.get("success"):-        print(f"COMMIT FAIL {rt['name']}: {live.get('errorCode')} {live.get('error')}")-        sys.exit(1)-    rev = live["revision"]-    open(REV_FILE, "w").write(rev)-    print(f"ok {rt['name']}: rev {rev[:10]} unconnected {live.get('unconnected', (live.get('drc') or {}).get('unconnected'))}")