Files
aigc-home/docs/hel-892/animate-document-evidence/package-sam3-animate.py.txt
T
2026-11-01 20:40:33 +08:00

13 lines
1.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""Exact 1.0.4 Range metadata and selected necessary text; no upstream imports."""
from pathlib import Path
import json,hashlib,datetime,zipfile,io,urllib.request
R=Path.cwd();F=R/'docs/hel-892/animate-reference'
s=(R/'.local-evidence/fetch-avatar-skills-release.py').read_text();exec(s[s.index('class Remote('):s.index('\ndef main():')])
meta=json.loads((F/'sam3pkg-version-registry.json').read_bytes());archive=Remote(meta['downloadUrl']);rows=json.loads((F/'sources.json').read_bytes())['sources'];selected=['__init__.py','pyproject.toml','LICENSE','requirements.txt']
with zipfile.ZipFile(archive)as z:
members=[dict(name=x.filename,size=x.file_size,compressed_size=x.compress_size,crc=x.CRC)for x in z.infolist()];(F/'sam3pkg-members.json').write_text(json.dumps(members,indent=2)+'\n')
for f in selected:
if f not in z.namelist():print('MISSING',f);continue
i=z.getinfo(f);assert i.file_size<3000000;raw=z.read(f);name='sam3pkg__'+f.replace('/','__');(F/name).write_bytes(raw);now=datetime.datetime.now(datetime.timezone.utc).isoformat();rows.append(dict(id='sam3pkg',file=f,local_file=name,tag='1.0.4',commit='未知:发布成员未绑定Git',tree='未知',url=meta['downloadUrl'],sha256=hashlib.sha256(raw).hexdigest(),package_sha256='unknown-not-downloaded-whole-archive',member_crc32=i.CRC,acquisition_time=now,reverified_at=now,license_file='sam3pkg__LICENSE',identity_root='.',identity_key='sam3pkg',applicability='本图准确SAM3 1.0.4必要发布成员,Range SHA/CRC,Git/整包未知'))
(F/'sam3pkg-range-proof.json').write_text(json.dumps(dict(size=archive.size,head_headers=archive.headers,ranges=archive.log),indent=2)+'\n');(F/'sources.json').write_text(json.dumps({'sources':rows},ensure_ascii=False,indent=2)+'\n');print((F/'sam3pkg____init__.py').read_text())