Add Windows version on PIME

Port the core (Zhuyin parser, classifier, converter, composition engine) to
Python as a PIME input method, with the same test cases as the Swift version
plus wrapper tests against stand-in PIME modules. scripts/package-windows.sh
builds a zip with install/uninstall scripts and a README for testers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-10 14:31:42 +08:00
co-authored by Claude Opus 5.5
parent 582dddabaa
commit e0eecc1eb5
20 changed files with 1385 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
#!/bin/bash
# Builds build/AutoZhuyin-Windows-<version>.zip: the PIME input method folder plus
# install/uninstall scripts and a README for testers.
set -euo pipefail
cd "$(dirname "$0")/.."
VERSION="$(python3 -I -c 'import json,sys; print(json.load(open(sys.argv[1]))["version"])' windows/autozhuyin/ime.json)"
NAME="AutoZhuyin-Windows-$VERSION"
OUT="build/$NAME"
python3 -I windows/tools/build_data.py
(cd windows && python3 -m unittest discover -q tests)
# Icon: render the Mac icon to PNG and wrap it in an .ico (PNG-in-ICO, Vista+).
if [ ! -f build/icon.tiff ]; then
DEVELOPER_DIR="${DEVELOPER_DIR:-/Applications/Xcode.app/Contents/Developer}" xcrun swift scripts/make-icon.swift build/icon.tiff
fi
sips -s format png -z 32 32 build/icon.tiff --out build/icon-32.png >/dev/null
python3 -I windows/tools/png_to_ico.py build/icon-32.png windows/autozhuyin/icon.ico
rm -rf "$OUT" "$OUT.zip"
mkdir -p "$OUT"
rsync -a --exclude __pycache__ --exclude '*.pyc' windows/autozhuyin "$OUT/"
# Windows tools expect CRLF line endings in .bat files.
for f in install.bat uninstall.bat README.txt; do
sed 's/$/\r/' "windows/installer/$f" > "$OUT/$f"
done
(cd build && zip -qr -X "$NAME.zip" "$NAME")
echo "Built build/$NAME.zip"