RoboHome / code /robohome /src /engine /real_test /seal_fusion.py
RoboParty Release
Unify robohome source, assets and scenes delivery
3f15e9f
Raw History Blame Contribute Delete
1.97 kB
"""Create a reproducible identity manifest for the local source tree."""
import hashlib
import json
from pathlib import Path
BASE = Path(__file__).resolve().parents[1]
def digest(path):
value = hashlib.sha256()
with path.open('rb') as stream:
for block in iter(lambda: stream.read(1024 * 1024), b''):
value.update(block)
return value.hexdigest()
def main():
paths = sorted(path for path in (BASE/'source').rglob('*')
if path.is_file() and '__pycache__' not in path.parts
and path.suffix != '.pyc' and path.name != '.DS_Store'
and not path.name.startswith('._')
and path.relative_to(BASE/'source').as_posix() not in {
'configs/floorplans/rplan_production_25.json',
'scripts/internal/scene_generation/real_assets/source_orientation_overrides.json',
'scripts/internal/scene_generation/real_assets/evidence/worktop_aperture_boundaries.json',
'scripts/internal/scene_generation/real_assets/tests/actual_bed_records.jsonl',
})
inventory = {str(path.relative_to(BASE)): digest(path) for path in paths}
(BASE/'BASE_SHA256SUMS').write_text(''.join(
sha+' '+name+'\n' for name, sha in inventory.items()))
origin = dict(schema='rhg.robohomegen-source-origin.v1',
version='independent-working-copy', source_files=len(inventory),
inventory_sha256=digest(BASE/'BASE_SHA256SUMS'),
excluded_external_inputs=[
'configs/floorplans/rplan_production_25.json',
'scripts/internal/scene_generation/real_assets/source_orientation_overrides.json',
'scripts/internal/scene_generation/real_assets/evidence/worktop_aperture_boundaries.json',
'scripts/internal/scene_generation/real_assets/tests/actual_bed_records.jsonl',
])
(BASE/'BASE_ORIGIN.json').write_text(json.dumps(origin, indent=2)+'\n')
print(json.dumps(origin))
if __name__ == '__main__':
main()