Some checks failed
CI / check (push) Waiting to run
CI / windows-build (push) Waiting to run
CI / macos-build (push) Waiting to run
Rodent IV / build (rodent-iv-linux-x86_64, ubuntu-22.04) (push) Failing after 41s
Rodent IV / build (rodent-iv-macos-arm64, macos-14) (push) Has been cancelled
Rodent IV / build (rodent-iv-windows-x86_64.exe, windows-latest) (push) Has been cancelled
Rodent IV / publish (push) Has been cancelled
The owner: «заюзаем rodent 4 со всеми его стилями». One opponent «Rodent»: its list gets Rodent IV's 13 characters and 22 players (sorted by their names as shown, the Tals side by side); the engine follows the style (Rodent IV's UCI_Elo 800–2800), «Rodent IV 2000 (Petrosian)» in the record. Texts say «Rodent» where they said «Rodent V». Rodent IV's authors publish no builds for Linux and Windows: the workflow rodent-iv.yml builds it from their sources at a pinned commit (with one fix, packaging/rodent-iv/home-dir.patch: on Linux it now and then took a wrong home folder and played without its personality) into a pre-release that is never «latest». The app downloads that build and the personalities and books from the authors' repository at the same commit (scripts/rodent4-manifest.py → rodent4_files.rs), each checked; three misnamed books get a copy under the name their personality reads. Until the build's sums are written in, Rodent IV's styles are not shown. Reviewed (tester and designer in one) with a local build (CP_RODENT4). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.8 KiB
Python
43 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""The files of Rodent IV that ChessPenguin downloads from the authors' repository
|
|
(personalities and opening books, docs/decisions.md «Rodent IV»), with sizes and SHA-256,
|
|
written as apps/desktop/src/rodent4_files.rs.
|
|
|
|
git clone https://github.com/nescitus/rodent-iv /tmp/rodent-iv
|
|
git -C /tmp/rodent-iv checkout <COMMIT>
|
|
python3 -I scripts/rodent4-manifest.py /tmp/rodent-iv
|
|
"""
|
|
import hashlib
|
|
import os
|
|
import subprocess
|
|
import sys
|
|
|
|
repo = sys.argv[1]
|
|
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
commit = subprocess.run(["git", "-C", repo, "rev-parse", "HEAD"], capture_output=True, text=True, check=True).stdout.strip()
|
|
files = []
|
|
for top in ("personalities", "books"):
|
|
for dirpath, _, names in os.walk(os.path.join(repo, top)):
|
|
for n in sorted(names):
|
|
path = os.path.join(dirpath, n)
|
|
rel = os.path.relpath(path, repo).replace(os.sep, "/")
|
|
# Chess960 is not played here.
|
|
if rel.endswith("guide_960.bin"):
|
|
continue
|
|
data = open(path, "rb").read()
|
|
files.append((rel, len(data), hashlib.sha256(data).hexdigest()))
|
|
files.sort()
|
|
out = [
|
|
"//! Generated by scripts/rodent4-manifest.py: the personalities and opening books of",
|
|
"//! Rodent IV as they are in the authors' repository at `COMMIT`, with their sizes and",
|
|
"//! SHA-256 (each is checked as it is downloaded).",
|
|
"",
|
|
f'pub const COMMIT: &str = "{commit}";',
|
|
"",
|
|
"/// (path in the repository, bytes, SHA-256).",
|
|
"pub const FILES: &[(&str, u64, &str)] = &[",
|
|
]
|
|
out += [f' ("{p}", {s}, "{h}"),' for p, s, h in files]
|
|
out += ["];", ""]
|
|
open(os.path.join(root, "apps", "desktop", "src", "rodent4_files.rs"), "w").write("\n".join(out))
|
|
print(len(files), "files,", sum(s for _, s, _ in files) // 1_000_000, "MB, commit", commit)
|