52 lines
1.8 KiB
Python
52 lines
1.8 KiB
Python
"""Rebind exact original texts for this graph only; no upstream execution."""
|
|
|
|
import hashlib
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parents[3]
|
|
REF = ROOT / "docs/hel-892/flux2-person-reference"
|
|
|
|
|
|
def main():
|
|
rows = json.loads((REF / "new-sources.json").read_bytes())["sources"]
|
|
for stem, keys in [
|
|
("flux2-img", {"core"}),
|
|
("flux2-clothing", {"negative"}),
|
|
("flux2", {"frontend"}),
|
|
]:
|
|
origin = REF.parent / (stem + "-reference")
|
|
for old in json.loads((origin / "sources.json").read_bytes())["sources"]:
|
|
if old["id"] not in keys:
|
|
continue
|
|
e = dict(old)
|
|
e.setdefault("identity_root", ".")
|
|
e.setdefault("identity_key", e["id"])
|
|
for key in ["local_file", "identity_root", "license_file"]:
|
|
e[key] = os.path.relpath((origin / e[key]).resolve(), REF)
|
|
rows.append(e)
|
|
for e in rows:
|
|
e.setdefault("identity_root", ".")
|
|
e.setdefault("identity_key", e["id"])
|
|
e["tree"] = (
|
|
(REF / e["identity_root"] / (e["identity_key"] + "-commit.txt"))
|
|
.read_text()
|
|
.splitlines()[0]
|
|
.removeprefix("tree ")
|
|
)
|
|
e["applicability"] = (
|
|
"仅人物迁移本图:各实例独立core0.8.2/0.9.1/0.9.2/0.28.3、fr"
|
|
"ontend1.36.14、Layer881bc917完整提交(aux仓库准确对象);宿"
|
|
"主声明不赋予内部身份,UE/tab/恢复及安装未知。"
|
|
)
|
|
assert hashlib.sha256((REF / e["local_file"]).read_bytes()).hexdigest() == e["sha256"]
|
|
(REF / "sources.json").write_text(
|
|
json.dumps({"sources": rows, "upstream_executed": False}, ensure_ascii=False, indent=2)
|
|
+ "\n"
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|