Files
photos/scripts/prepare-node-assets.py
waozi 938782866e Release portable Photos 1.0.6 for current Inner Breeze
Move the independently downloadable gallery to pushed Ziran 0.6 and
namespaced Kryon widgets, preserving gallery position, picker, Trash,
account identity and the guarded shared compression service. Build and
verify ZX28 bytes from its own locked package and publish those exact
bytes through the node release workflow. Keep the native app version.

Local validation: make -j1 node-photos-test passed native behavior,
ABI rejection, signed metadata, payload identity and tamper rejection.
Release workflow shell syntax and locked compiler output passed.

The separate root make test remains blocked by its legacy kryon/Widgets
viewer; its locked alternative also has an inconsistent image_codec pin.
Record that native graph migration in plans/2026-11-16-native-graph.md.
The root manifest, peer lock and local override remain untouched.
2026-11-16 22:51:25 -03:00

32 lines
1.5 KiB
Python

"""Stage only Photos' catalog, translations and licensed achievement icons."""
import json
from pathlib import Path
import re
import shutil
import sys
root = Path(__file__).resolve().parent.parent
source = root / "portable"
destination = root / "build/package-assets/photos/assets/photos"
package = Path(sys.argv[1])
destination.mkdir(parents=True, exist_ok=True)
shutil.copyfile(source / "achievements.json", destination / "achievements.json")
shutil.copytree(source / "achievement-locales", destination / "achievement-locales", dirs_exist_ok=True)
icons = destination / "icons"
icons.mkdir(exist_ok=True)
for achievement in json.loads((source / "achievements.json").read_text())["achievements"]:
name = achievement["icon_source"]
if not re.fullmatch(r"mingcute_(?:regular|filled|extra)_[a-z0-9_]+", name):
raise ValueError("invalid Photos achievement icon source")
match = re.search(r'^Shape :: (".*");$', (package / "src" / (name + ".zi")).read_text(), re.M)
if not match:
raise ValueError(f"missing icon shape: {name}")
shape = json.loads(match[1])
if not shape or len(shape.encode()) >= 1024 or shape[0] not in "SF":
raise ValueError(f"invalid icon shape: {name}")
expected = f"assets/photos/icons/{achievement['id']}.shape"
if achievement["icon"] != expected:
raise ValueError("unexpected Photos achievement icon path")
(icons / (achievement["id"] + ".shape")).write_text(shape)
shutil.copyfile(package / "LICENSE", icons / "LICENSE")