Files
aigc-home/docs/hel-892/scail-document-evidence/setup-scail-sources.py.txt
T
2026-11-01 18:11:45 +08:00

22 lines
3.3 KiB
Plaintext

from pathlib import Path
import json,hashlib,os,datetime,subprocess,concurrent.futures
R=Path.cwd();REF=R/'docs/hel-892/scail-reference';OUT=R/'docs/hel-892/scail-document-evidence';REF.mkdir(exist_ok=True);OUT.mkdir(exist_ok=True);now=datetime.datetime.now(datetime.timezone.utc).isoformat();rows=[]
def reuse(folder,oldid,newid,files):
p=R/'docs/hel-892'/folder/'sources.json'
for original in json.loads(p.read_bytes())['sources']:
if original['id']!=oldid or original['file']not in files:continue
e=dict(original,id=newid,reverified_at=now,applicability='第159批准确逐实例静态复核,不认证目标安装/恢复/执行')
for key in ['local_file','license_file','identity_root','canonical_identity_record']:
if key in e and(p.parent/e[key]).exists():e[key]=os.path.relpath((p.parent/e[key]).resolve(),REF)
e.setdefault('acquisition_time','未知:旧记录未载首次获取时间');assert hashlib.sha256((REF/e['local_file']).read_bytes()).hexdigest()==e['sha256'];rows.append(e)
reuse('krea-semireal-reference','core0250','core0250',['nodes.py','comfy_extras/nodes_primitive.py','comfy_extras/nodes_preview_any.py','LICENSE','requirements.txt'])
reuse('vosr2-loop-reference','batch','easy',['__init__.py','py/nodes/logic.py','LICENSE'])
# Authored fetch helper only; never execute acquired source.
s=(R/'.local-evidence/setup-anima.py').read_text();exec('def fetch(spec):'+s.split('def fetch(spec):')[1].split('with concurrent.futures')[0].replace('anima-','scail-'))
specs=[('core0193','Comfy-Org/ComfyUI','v0.19.3',['nodes.py','LICENSE','requirements.txt']),('core0240','Comfy-Org/ComfyUI','v0.24.0',['nodes.py','comfy_extras/nodes_video.py','comfy_extras/nodes_wan.py','comfy_extras/nodes_custom_sampler.py','comfy_extras/nodes_primitive.py','comfy_extras/nodes_logic.py','comfy_extras/nodes_math.py','comfy_extras/nodes_images.py','comfy_extras/nodes_image_scale.py','comfy_extras/nodes_model_advanced.py','comfy_extras/nodes_preview_any.py','comfy_api/latest/_io.py','comfy_api/latest/_io_public.py','LICENSE','requirements.txt']),('core0271','Comfy-Org/ComfyUI','v0.27.1',['comfy_extras/nodes_video.py','comfy_api/latest/_io.py','comfy_api/latest/_io_public.py','LICENSE','requirements.txt']),('kjint','kijai/ComfyUI-KJNodes','3e80b28dec889b0d082c3bd3aeb0bf30ab6b5ab2',['__init__.py','nodes/nodes.py','LICENSE','requirements.txt','pyproject.toml']),('rgthree','rgthree/rgthree-comfy','27b4f4cdcf3b127c29d5d8135ac1536ecbd4c383',['__init__.py','py/display_any.py','py/constants.py','py/utils.py','web/comfyui/display_any.js','src_web/comfyui/display_any.ts','LICENSE','pyproject.toml']),('frontend','Comfy-Org/ComfyUI_frontend','v1.45.15',['package.json','pnpm-lock.yaml','pnpm-workspace.yaml','src/scripts/widgets.ts','src/scripts/app.ts','src/lib/litegraph/src/LGraphNode.ts','src/lib/litegraph/src/litegraph.ts','src/lib/litegraph/LICENSE','LICENSE'])]
with concurrent.futures.ThreadPoolExecutor(max_workers=4)as pool:
for result in pool.map(fetch,specs):rows+=result
for e in rows:
if not e.get('license_file','').startswith('未知')and not(REF/e.get('license_file','')).is_file():e['license_file']=next((x['local_file']for x in rows if x['id']==e['id']and x['file'].lower()in ['license','license.txt','license.md']),'未知:准确必要路径无许可文本')
(REF/'sources.json').write_text(json.dumps(dict(sources=rows),ensure_ascii=False,indent=2)+'\n');print('ROWS',len(rows))