Skip to content

Commit c80ca96

Browse files
committed
feat: improve magic file processing and clean up registry entries
1 parent 33e9284 commit c80ca96

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

scripts/update_registry.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,16 @@ def main():
8686
print("magic/upload/ n'existe pas, rien à faire.")
8787
return 0
8888

89+
8990
registry = load_registry()
9091

9192
magic_files = [p for p in DIST_DIR.glob("*.magic") if p.is_file()]
92-
if not magic_files:
93-
print("Aucun .magic trouvé dans magic/upload/.")
94-
return 0
95-
93+
magic_names = set()
9694
for magic_path in magic_files:
9795
m = FILENAME_RE.match(magic_path.name)
9896
if not m:
9997
print(f"Ignore {magic_path.name} (nom inattendu)")
10098
continue
101-
10299
name = m.group("name")
103100
build_id = m.group("buildid")
104101
try:
@@ -108,6 +105,7 @@ def main():
108105
continue
109106
version = infos.get("version", "unknown")
110107
build_type = parse_build_type(build_id)
108+
magic_names.add((name, version))
111109

112110
if infos.get("version") and infos["version"] != version:
113111
print(f"[WARN] version mismatch: filename={version} / infos.json={infos['version']}")
@@ -144,6 +142,9 @@ def main():
144142
upsert_model(registry, entry)
145143
print(f"✅ Ajout/MàJ: {entry['name']} {entry['version']} ({build_type})")
146144

145+
# Supprimer du manifest les modèles dont le .magic n'existe plus
146+
registry["models"] = [m for m in registry["models"] if (m.get("name"), m.get("version")) in magic_names]
147+
147148
save_registry(registry)
148149
print(f"💾 Écrit {REGISTRY_PATH}")
149150
return 0

0 commit comments

Comments
 (0)