snf_experiments / paper_export /evidence /code /packaging /create_source_manifest.py
CharlesZhang-USTC's picture
Add files using upload-large-folder tool
ea1b5d0 verified
Raw History Blame Contribute Delete
611 Bytes
"""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')