"""Check the immutable files listed in the upload manifest (standard library).""" from pathlib import Path from hashlib import sha256 import json ROOT=Path(__file__).resolve().parent.parent manifest=json.loads((ROOT/'anc/package-manifest.json').read_text()) for f in manifest['files']: p=ROOT/f['path'] assert p.is_file(), f['path'] assert p.stat().st_size==f['bytes'], f['path'] assert sha256(p.read_bytes()).hexdigest()==f['sha256'], f['path'] print('PASS: '+str(len(manifest['files']))+' packaged files match their SHA-256 hashes.')