Files
Sanctification/spikes/rejected-compositions/finish-mask-line-continuity-proof/install-raw-ridges.py

19 lines
1.1 KiB
Python

"""Install only the new raw-ridge fixtures; refuse replacements."""
from pathlib import Path
import hashlib,json
ROOT=Path(__file__).resolve().parent
RAW=ROOT/'raw-ridges'
PUBLIC=ROOT.parents[1]/'card-harness/public/card-art'
def sha(p): return hashlib.sha256(p.read_bytes()).hexdigest()
assert json.loads((RAW/'validation.json').read_text())['status']=='passed'
preserved=json.loads((RAW/'preserved-runtime-hashes.json').read_text())
for name,digest in preserved.items(): assert sha(PUBLIC/name)==digest,name
files=sorted(RAW.glob('*/output/runtime/*.png'));assert len(files)==6
for src in files: assert not (PUBLIC/src.name).exists(),src.name
installed=[]
for src in files:
dest=PUBLIC/src.name;dest.write_bytes(src.read_bytes());assert sha(dest)==sha(src);installed.append({'name':dest.name,'sha256':sha(dest)})
for name,digest in preserved.items(): assert sha(PUBLIC/name)==digest,name
(RAW/'install-report.json').write_text(json.dumps({'status':'passed','existingPngFilesPreserved':len(preserved),'files':installed,'movingLightReview':'User comparison pending'},indent=2)+'\n')
print('Installed two raw-ridge fixtures; existing PNGs preserved.')