2026-10-29 17:27:47 +02:00
|
|
|
"""Package only distributable files; exclude editor caches and player saves."""
|
|
|
|
|
from pathlib import Path
|
|
|
|
|
import hashlib
|
|
|
|
|
import zipfile
|
2026-10-30 00:23:30 +02:00
|
|
|
import argparse
|
|
|
|
|
|
|
|
|
|
parser = argparse.ArgumentParser()
|
|
|
|
|
parser.add_argument("--windows-dir", default="Windows")
|
|
|
|
|
parser.add_argument("--version", default="0.2.1")
|
|
|
|
|
args = parser.parse_args()
|
2026-10-29 17:27:47 +02:00
|
|
|
|
|
|
|
|
root = Path(__file__).resolve().parents[1]
|
|
|
|
|
builds = root / "builds"
|
2026-10-30 00:23:30 +02:00
|
|
|
windows = builds / args.windows_dir
|
|
|
|
|
assert windows.resolve().is_relative_to(builds.resolve())
|
|
|
|
|
assert all(c in "0123456789." for c in args.version)
|
|
|
|
|
windows_zip = builds / f"DoOtboy_v{args.version}_Windows.zip"
|
|
|
|
|
source_zip = builds / f"DoOtboy_v{args.version}_Source.zip"
|
|
|
|
|
with zipfile.ZipFile(windows_zip, "w", zipfile.ZIP_DEFLATED, compresslevel=6) as archive:
|
2026-10-29 22:31:17 +02:00
|
|
|
for name in ("DoOtboy.exe", "README_RU.md", "SCENARIO_RU.md", "AUDIO_CREDITS.md", "GODOT_LICENSE.txt"):
|
2026-10-29 17:27:47 +02:00
|
|
|
archive.write(windows / name, "DoOtboy/" + name)
|
|
|
|
|
|
2026-10-30 00:23:30 +02:00
|
|
|
with zipfile.ZipFile(source_zip, "w", zipfile.ZIP_DEFLATED, compresslevel=6) as archive:
|
2026-10-29 22:31:17 +02:00
|
|
|
for name in ("README_RU.md", "SCENARIO_RU.md", "AUDIO_CREDITS.md", "GODOT_LICENSE.txt", "build.ps1", ".gitignore"):
|
2026-10-29 17:27:47 +02:00
|
|
|
archive.write(root / name, "DoOtboy/" + name)
|
2026-10-30 00:23:30 +02:00
|
|
|
for name in ("make_audio.py", "make_phone_effects.py", "write_phone_story.py", "make_draft_voices.ps1", "split_voice_batch.py", "install_jessica_voice.py", "package.py"):
|
2026-10-29 17:27:47 +02:00
|
|
|
archive.write(root / "tools" / name, "DoOtboy/tools/" + name)
|
2026-10-30 00:23:30 +02:00
|
|
|
for name in ("README_RU.md", "manifest.json", "alignment.json"):
|
|
|
|
|
archive.write(root / "voiceover/jessica" / name, "DoOtboy/voiceover/jessica/" + name)
|
2026-10-29 17:27:47 +02:00
|
|
|
for path in (root / "do-otboy").rglob("*"):
|
|
|
|
|
if not path.is_file() or ".godot" in path.parts or path.suffix == ".import":
|
|
|
|
|
continue
|
|
|
|
|
archive_name = "DoOtboy/" + path.relative_to(root).as_posix()
|
|
|
|
|
if path.name == "export_presets.cfg":
|
|
|
|
|
portable = path.read_text(encoding="utf-8").replace(
|
|
|
|
|
'custom_template/release="../tools/templates/windows_release_x86_64.exe"',
|
|
|
|
|
'custom_template/release=""',
|
|
|
|
|
)
|
|
|
|
|
archive.writestr(archive_name, portable)
|
|
|
|
|
else:
|
|
|
|
|
archive.write(path, archive_name)
|
|
|
|
|
|
2026-10-30 00:23:30 +02:00
|
|
|
for path in (windows_zip, source_zip):
|
2026-10-29 17:27:47 +02:00
|
|
|
digest = hashlib.sha256(path.read_bytes()).hexdigest()
|
2026-10-30 00:23:30 +02:00
|
|
|
print(f"{path.name}: {path.stat().st_size:,} bytes; SHA256 {digest}")
|
2026-10-29 17:27:47 +02:00
|
|
|
|
2026-10-30 00:23:30 +02:00
|
|
|
with zipfile.ZipFile(windows_zip) as archive:
|
2026-10-29 17:27:47 +02:00
|
|
|
assert archive.testzip() is None
|
2026-10-30 00:23:30 +02:00
|
|
|
with zipfile.ZipFile(source_zip) as archive:
|
2026-10-29 17:27:47 +02:00
|
|
|
assert archive.testzip() is None
|
|
|
|
|
print("Both ZIP archives verified")
|