"""Release-local entry point. See README.md; no --release argument is needed.""" import argparse import hashlib import json import os from pathlib import Path import subprocess import sys SCRIPT=Path(__file__).resolve().parent RELEASE=SCRIPT.parent ROOT=RELEASE.parent sys.dont_write_bytecode=True def main(): p=argparse.ArgumentParser(description=__doc__) p.add_argument('command',choices=['preflight','inventory','pilot','full','validate','review','checksums']) p.add_argument('--sequence',help='OakInk sequence; ReInterHand capture for pilot') p.add_argument('--segment',help='ReInterHand pilot action') p.add_argument('--tensors',action='store_true') p.add_argument('--media',action='store_true') a=p.parse_args() c=json.loads((SCRIPT/'config.json').read_text()) def path(k): v=Path(c[k]); return v if v.is_absolute() else (ROOT/v).resolve() env=os.environ.copy() env['PYTHONDONTWRITEBYTECODE']='1' for k in ('OMP_NUM_THREADS','MKL_NUM_THREADS','OPENBLAS_NUM_THREADS','NUMEXPR_NUM_THREADS'): env[k]='1' packages=path('packages') env['PYTHONPATH']=str(packages)+os.pathsep+env.get('PYTHONPATH','') def run(name,args): subprocess.run([sys.executable,str(SCRIPT/name),*map(str,args)],check=True,env=env) reinter=c['dataset']=='ReInterHand' if a.command=='checksums': rows=json.loads((SCRIPT/'checksums.json').read_text()) for rel,h in rows.items(): if hashlib.sha256((SCRIPT/rel).read_bytes()).hexdigest()!=h: raise RuntimeError('script differs: '+rel) print('Script checksums passed:',len(rows)); return if a.command=='validate': run('validate_release.py',(['--tensors'] if a.tensors else [])+(['--media'] if a.media else [])); return if a.command=='preflight': if not (ROOT/'raw').is_dir(): raise RuntimeError('Missing raw sibling') if not all((path('models')/n).is_file() for n in ('MANO_LEFT.pkl','MANO_RIGHT.pkl')): raise RuntimeError('Configure licensed MANO files in config.json models') subprocess.run([sys.executable,'-c','import numpy,torch,PIL,smplx'+(',cv2' if reinter else ',scipy,imageio_ffmpeg')],env=env,check=True) subprocess.run(['ffmpeg','-version'],check=True,stdout=subprocess.DEVNULL) import shutil if shutil.disk_usage(ROOT).free