95 lines
3.2 KiB
Python
95 lines
3.2 KiB
Python
"""Read necessary helpers from already fetched exact Git objects only."""
|
|
|
|
import datetime
|
|
import hashlib
|
|
import json
|
|
import subprocess
|
|
from pathlib import Path
|
|
|
|
OUT = Path(__file__).resolve().parent
|
|
ROOT = OUT.parents[2]
|
|
REF = OUT.parent / "minimax-music-reference"
|
|
|
|
|
|
def main():
|
|
manifest = json.loads((REF / "sources.json").read_bytes())
|
|
for key, files in [
|
|
(
|
|
"core",
|
|
["comfy_extras/nodes_seed.py", "node_helpers.py", "comfy_extras/nodes_minimax_h3.py"],
|
|
),
|
|
(
|
|
"frontend",
|
|
[
|
|
"src/stores/widgetValueStore.ts",
|
|
"src/core/graph/subgraph/promotionUtils.ts",
|
|
"src/core/graph/subgraph/promotedInputWidget.ts",
|
|
"src/scripts/promotedWidgetControl.ts",
|
|
],
|
|
),
|
|
]:
|
|
cache = ROOT / ".local-evidence" / ("minimax-music-" + key + "-git")
|
|
prior = next(e for e in manifest["sources"] if e["id"] == key)
|
|
tree = json.loads((REF / (key + "-tree.json")).read_bytes())
|
|
for file in files:
|
|
raw = subprocess.check_output(
|
|
["git", "-C", str(cache), "show", prior["commit"] + ":" + file]
|
|
)
|
|
name = key + "__" + file.replace("/", "__")
|
|
(REF / name).write_bytes(raw)
|
|
row = dict(
|
|
prior,
|
|
file=file,
|
|
local_file=name,
|
|
url=f"https://raw.githubusercontent.com/{prior['repo']}/{prior['commit']}/{file}",
|
|
sha256=hashlib.sha256(raw).hexdigest(),
|
|
git_blob_sha1=next(e["sha"] for e in tree["tree"] if e["path"] == file),
|
|
acquisition_time=datetime.datetime.now(datetime.timezone.utc).isoformat(),
|
|
)
|
|
manifest["sources"] = [
|
|
e for e in manifest["sources"] if not (e["id"] == key and e["file"] == file)
|
|
] + [row]
|
|
(REF / "sources.json").write_text(json.dumps(manifest, ensure_ascii=False, indent=2) + "\n")
|
|
r = subprocess.run(
|
|
[
|
|
"git",
|
|
"-C",
|
|
str(ROOT / ".local-evidence/minimax-music-core-git"),
|
|
"grep",
|
|
"-n",
|
|
"-e",
|
|
"MiniMaxMusic3TextEncode",
|
|
"-e",
|
|
"EmptyMiniMaxMusic3LatentAudio",
|
|
"FETCH_HEAD",
|
|
"--",
|
|
"*.py",
|
|
],
|
|
capture_output=True,
|
|
text=True,
|
|
)
|
|
assert r.returncode == 1 and not r.stdout and not r.stderr
|
|
(REF / "missing-music-classes.json").write_text(
|
|
json.dumps(
|
|
dict(
|
|
commit=prior["commit"]
|
|
if key == "core"
|
|
else json.loads((REF / "core-tag.json").read_bytes())["commit"],
|
|
query=["MiniMaxMusic3TextEncode", "EmptyMiniMaxMusic3LatentAudio"],
|
|
scope="exact full tree tracked *.py; git grep literals",
|
|
returncode=r.returncode,
|
|
stdout=r.stdout,
|
|
stderr=r.stderr,
|
|
conclusion="两类未在准确core0.31.0 Python树出现;不向新版补schema",
|
|
checked_at=datetime.datetime.now(datetime.timezone.utc).isoformat(),
|
|
),
|
|
ensure_ascii=False,
|
|
indent=2,
|
|
)
|
|
+ "\n"
|
|
)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|