File size: 611 Bytes
ea1b5d0
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
"""Hash vendored code without modifying upstream repositories."""
import hashlib
import json
from pathlib import Path
root=Path(__file__).resolve().parents[1]
manifest={}
for path in sorted((root/'vendor').rglob('*')):
    if not path.is_file() or any(x in path.parts for x in ('.git','__pycache__','checkpoints','wandb')) or path.suffix.lower() in ('.mp4','.gif','.pyc'):continue
    manifest[path.relative_to(root).as_posix()]=hashlib.sha256(path.read_bytes()).hexdigest()
(root/'packaging/sources.manifest.json').write_text(json.dumps(manifest,indent=2)+'\n')
print(f'Hashed {len(manifest)} vendored files')