refactor: read data/.versions.json in one place

This commit is contained in:
Abdessamad Derraz committed 2026-11-21 05:59:51 +01:00
1 parent 67cb99606d
commit 82d3f595de
5 files changed
+14 -32

No files matched your search

+4 -4
View File
@@ -87,9 +87,9 @@ def list_release_pack_platforms(platforms_dir: str = PLATFORMS_DIR) -> list[str]
VERSIONS_FILE = "data/.versions.json"
def load_versions(versions_path: str = VERSIONS_FILE) -> dict[str, dict]:
def load_versions(versions_path: str | os.PathLike[str] = VERSIONS_FILE) -> dict[str, dict]:
"""What refresh_data_dirs recorded of each tree's last fetch."""
path = Path(versions_path)
if not path.exists():
if not path.is_file():
return {}
with open(path) as f:
return json.load(f)
return json.loads(path.read_text(encoding="utf-8"))