Files
nyaterm/scripts/release/windows_portable.py
T
Kang f89a8edb8a feat(portable): implement Windows portable update handling and validation (#1089)
- Added support for testing and validating portable updates on Windows, including handling ARM64 executables.
- Introduced a new module for managing the portable package contract, ensuring consistency between the Rust and Python packaging processes.
- Updated the release workflow to include tests for portable ZIP files, validating their structure and contents against the defined contract.
- Enhanced error handling for portable updates, including recovery mechanisms for failed updates.
- Added comprehensive tests to ensure the integrity and correctness of portable package handling.

This update significantly improves the reliability and user experience of the portable updater, addressing previous issues with ConPTY and ActiveX file handling.
2026-11-01 19:41:17 +08:00

31 lines
748 B
Python

"""Read the portable payload contract also embedded by nyaterm-core."""
from __future__ import annotations
import json
from pathlib import Path
CONTRACT_PATH = (
Path(__file__).resolve().parents[2]
/ "crates/nyaterm-core/src/packaging/windows-portable.json"
)
LAYOUT = json.loads(CONTRACT_PATH.read_text(encoding="utf-8"))
def payload_files(target: str) -> tuple[str, ...]:
return (
*LAYOUT["program_files"],
*LAYOUT["helper_files"],
*LAYOUT["support_files"],
*LAYOUT["conpty_files"][target],
LAYOUT["marker"],
)
def archive_files(target: str) -> set[str]:
return {
f'{LAYOUT["root"]}/{name}'
for name in (*payload_files(target), LAYOUT["data_placeholder"])
}