Files
ShortVideoGenerator/projects/water-hydrogen-bond-surface-tension/blender/production_preserve.py
T

36 lines
1.9 KiB
Python

"""승인 원본·선행 단계·기존 WAV·스타일의 바이트 보존을 실제 대조한다."""
import hashlib
import json
from pathlib import Path
import subprocess
ROOT=Path(__file__).resolve().parents[3]
PROJECT=ROOT/'projects/water-hydrogen-bond-surface-tension'
BASE=PROJECT/'stages/12-motion/r2'
PINNED='6b00a8f'
records=[]
def check(path,expected,kind):
actual=hashlib.sha256((ROOT/path).read_bytes()).hexdigest()
assert actual==expected, '기존 결과 바이트 변경: '+path
records.append(dict(path=path,sha256=actual,baseline=kind))
approved=json.loads((PROJECT/'stages/08-scenes/r3/design-check.json').read_text(encoding='utf-8'))
for item in approved['actual_assets']:
check(item['path'],item['sha256'],'08 r3 승인 실물 목록')
original=json.loads((PROJECT/'stages/08-scenes/r3/preservation-check.json').read_text(encoding='utf-8'))['baseline_sha256']
for path,sha in original.items():
if path.endswith('.wav') or path.endswith('stages/08-scenes/r2/generated-source/preview.blend'):
check(path,sha,'08 r3 보존 기준')
paths=subprocess.check_output(['git','ls-tree','-r','--name-only',PINNED,'--','references','projects/water-hydrogen-bond-surface-tension/stages'],cwd=ROOT,text=True,encoding='utf-8').splitlines()
for path in paths:
parts=Path(path).parts
if path.startswith('references/') or (len(parts)>4 and (int(parts[3][:2])<=9 or parts[4]=='r1')):
data=subprocess.check_output(['git','cat-file','--filters','--path='+path,PINNED+':'+path],cwd=ROOT)
check(path,hashlib.sha256(data).hexdigest(),PINNED+' 작업 사본 체크아웃 바이트')
value=dict(result='GREEN',pinned_commit=PINNED,unchanged_files=len(records),files=records)
(BASE/'preservation-check.json').write_text(json.dumps(value,ensure_ascii=False,indent=2)+'\n',encoding='utf-8')
print('기존 승인 입력·WAV·스타일 보존 GREEN',len(records))