main
John Lauer
Review component pin functions and validate isolated library model and hole corrections
7fb4d36
"""Validate the metadata-only candidate with project libraries in the isolated native job."""
import json,subprocess
from pathlib import Path
root=Path(__file__).resolve().parents[1];out=root/'checkpoints/library-metadata-review'
remote='C:/Users/john/AppData/Local/Temp/kicad-cli-1791737983-4056375'
def call(v,a,label):
r=subprocess.run(['adom-bridge','--target','AdomLapper','--ai-thread','adom-custom-load',v,json.dumps(a)],capture_output=True,text=True)
d=json.loads(r.stdout);(out/(label+'.json')).write_text(json.dumps(d,indent=2)+'\n')
assert r.returncode==0 and d.get('success',d.get('ok',True)) and not d.get('errors') and d.get('exitCode',0)==0,d
return d
call('send_files',{'filePaths':[str(root/'kicad/fp-lib-table')]+[str(out/('d1-mpn-candidate.'+e)) for e in ['kicad_pcb','kicad_pro','kicad_dru']],'dest':remote+'/','reason':'Include project footprint library configuration in isolated DRC validation'},'send-table')
for name in ['Load','Molecule']:
call('send_files',{'filePaths':[str(p) for p in (root/'kicad/lib'/f'{name}.pretty').glob('*.kicad_mod')],'dest':remote+'/lib/'+name+'.pretty','reason':'Include actual project footprint libraries in isolated DRC validation'},'send-'+name)
s=call('kicad_status',{},'native-status')
cli=s['install']['kicadCli']
call('shell_execute',{'command':'"'+cli+'"','args':['pcb','drc','--refill-zones','--format','json','--output',remote+'/native-drc-with-libraries.json',remote+'/d1-mpn-candidate.kicad_pcb'],'timeoutSeconds':120,'reason':'Recheck candidate with unchanged rules and complete project libraries'},'native-drc-command')
call('pull_file',{'filePaths':[remote+'/native-drc-with-libraries.json'],'saveTo':str(out)},'pull-drc')
r=json.loads((out/'native-drc-with-libraries.json').read_text());print(json.dumps({'violations':len(r['violations']),'opens':len(r['unconnected_items']),'types':[x['type'] for x in r['violations']]}))