Files
Diabolo/tools/package_v15.py
T

56 lines
3.1 KiB
Python

from pathlib import Path
import hashlib, json, shutil, zipfile
root=Path(__file__).resolve().parent.parent
src=root/'Demon_v0.15'
win=root/'Demon_v0.15_Windows'
qa=root/'qa_v15'
markers={
'release-tests.log':'ALL WORKSHOP TESTS PASSED',
'release-sentences.log':'ALL SENTENCE TESTS PASSED',
'release-ui.log':'PASS: actual mouse input',
'release-audio.log':'original placement and deletion effects',
'release-capture.log':'CAPTURE_BUILD:',
'probe.log':'BUILD_PROBE:',
}
for name,marker in markers.items():
log=(qa/name).read_text(encoding='utf-8-sig')
assert marker in log,name
assert not any(word in log for word in ['ERROR:','Assertion failed','QA check failed']),name
probe=json.loads(next(line.split('BUILD_PROBE: ',1)[1] for line in (qa/'probe.log').read_text(encoding='utf-8-sig').splitlines() if 'BUILD_PROBE: ' in line))
assert probe['id'].startswith('0.15-') and probe['id']!='0.15-editor'
assert 'CAPTURE_BUILD: '+probe['id'] in (qa/'release-capture.log').read_text(encoding='utf-8-sig')
def sha(path):return hashlib.sha256(path.read_bytes()).hexdigest()
for name in ['README_RU.md','README_0.13.md','AUDIO_CREDITS.md','MODEL_CREDITS.md','MODEL_LICENSE_CC0.txt','GODOT_LICENSE.txt']:
shutil.copy2(src/name,win/name)
for name in ['KellySlab-OFL.txt','RuslanDisplay-OFL.txt']:
shutil.copy2(src/'art/fonts'/name,win/name)
(win/'QA').mkdir(exist_ok=True)
for name in markers:shutil.copy2(qa/name,win/'QA'/name)
for shot in (win/'captures/v013').glob('*.png'):shutil.copy2(shot,src/'captures/v013'/shot.name)
manifest={
'version':'0.15','date':'2026-10-27','build_id':probe['id'],
'engine':'Godot 4.3.stable.official.77dcf97d8',
'binary_sha256':sha(win/'Demon.exe'),
'validation':{'release_gameplay':'passed','release_mouse_ui':'passed','release_audio':'passed','release_capture':'passed','release_sentences':'passed'},
'starting_gold':240,'arrival_interval_seconds':3,'queue_warning_threshold':7,'queue_capacity':7,
'skill_columns':3,'maximum_helpers':3,'apparatus_types':6,'maximum_punishments':3,'level_area_scale':1.25,
}
(win/'BUILD_MANIFEST.json').write_text(json.dumps(manifest,ensure_ascii=False,indent=2),encoding='utf-8')
for folder,label in [(win,'Windows'),(src,'Source')]:
dest=root/f'Demon_v0.15_{label}.zip'
with zipfile.ZipFile(dest,'w',zipfile.ZIP_DEFLATED,compresslevel=6) as archive:
for path in sorted(folder.rglob('*')):
if not path.is_file() or '.godot' in path.parts:continue
if path.suffix=='.log' and path.parent!=win/'QA':continue
rel=path.relative_to(folder)
if label=='Source' and rel.parts[0]=='captures' and 'v013' not in rel.parts:continue
archive.write(path,Path(folder.name)/rel)
if label=='Source':
for name in ['build_v15.ps1','fetch_windows_template.py','package_v15.py','make_infernal_pop.py']:
archive.write(root/'tools'/name,Path('tools')/name)
with zipfile.ZipFile(dest) as archive:assert archive.testzip() is None
print(f'VERIFIED {dest.name} {dest.stat().st_size} bytes SHA256 {sha(dest)}')
print('BUILD_ID '+probe['id'])