Files
CawDPSMeterandClaude Sonnet 5.5 524274bb55 Release 1.1.7: damage shield damage and Threat table order
Version 1.1.7 with combat-text damage shield (reflect) parsing and the server
Threat percentage ordering. Adds release notes and the new regression files to
the release script.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-25 05:18:46 +01:00

70 lines
4.3 KiB
Python

"""Package only public runtime files; verify archive bytes and produce SHA-256."""
from pathlib import Path
import argparse
import hashlib
import re
import shutil
import zipfile
ROOT = Path(__file__).resolve().parents[1]
parser=argparse.ArgumentParser()
parser.add_argument('--sync-checkout', action='store_true')
args=parser.parse_args()
toc = (ROOT / 'CawDPSMeter.toc').read_text(encoding='utf-8')
# The installed maintainer copy keeps its private overlay. Public builds exclude
# both its loader entry and source, including the talent-status display.
private_files = {'CawLocalSyncStatus.lua'}
toc = '\n'.join(line for line in toc.splitlines() if line.strip() not in private_files) + '\n'
version = re.search(r'^## Version: (.+)$', toc, re.M).group(1).strip()
assert re.fullmatch(r'\d+\.\d+\.\d+', version), 'Expected a stable release version'
assert f'D.version = "{version}"' in (ROOT / 'CawDPSMeter.lua').read_text(encoding='utf-8')
runtime = [line.strip() for line in toc.splitlines() if line.strip() and not line.startswith('#')]
assert 'CawLocalSyncStatus.lua' not in runtime, 'Local-only status display enabled: do not publish this personal TOC.'
files = sorted(set(runtime + ['CawDPSMeter.toc', 'LICENSE', 'README.md', 'CHANGELOG.md',
f'RELEASE_NOTES_{version}.md'] +
[p.relative_to(ROOT).as_posix() for p in (ROOT / 'Media').iterdir() if p.suffix in ('.tga', '.wav')]))
stage = ROOT / '.release' / f'package-{version}' / 'CawDPSMeter'
out = ROOT / 'dist'
out.mkdir(exist_ok=True)
archive = out / f'CawDPSMeter-{version}.zip'
def public_bytes(name):
return toc.encode('utf-8') if name == 'CawDPSMeter.toc' else (ROOT / name).read_bytes()
assert not private_files.intersection(files)
with zipfile.ZipFile(archive, 'w', zipfile.ZIP_DEFLATED) as z:
for name in files:
src = ROOT / name
assert src.is_file(), name
dst = stage / name
dst.parent.mkdir(parents=True, exist_ok=True)
dst.write_bytes(public_bytes(name))
z.writestr('CawDPSMeter/' + name, public_bytes(name))
with zipfile.ZipFile(archive) as z:
assert z.testzip() is None
assert len(z.namelist()) == len(files)
for name in files:
assert z.read('CawDPSMeter/' + name) == public_bytes(name)
assert not any('CawLocalSyncStatus' in name for name in z.namelist())
assert b'CawLocalSyncStatus' not in z.read('CawDPSMeter/CawDPSMeter.toc')
for name in runtime:
text = (ROOT / name).read_text(encoding='utf-8')
for media in re.findall(r'(Caw[A-Za-z]+\.(?:tga|wav))', text):
assert 'Media/' + media in files, media
digest = hashlib.sha256(archive.read_bytes()).hexdigest()
(out / (archive.name + '.sha256')).write_text(digest + ' ' + archive.name + '\n', encoding='utf-8')
shutil.copyfile(ROOT / f'RELEASE_NOTES_{version}.md', out / f'RELEASE_NOTES_{version}.md')
# Populate an already-cloned public checkout, never copy saved data/private notes.
checkout = ROOT / '.release' / 'github-source'
if args.sync_checkout and (checkout / '.git').is_dir():
for name in files:
dst = checkout / name
dst.parent.mkdir(parents=True, exist_ok=True)
dst.write_bytes(public_bytes(name))
for src in (ROOT / 'tests').iterdir():
if src.name in ('run_regressions.py', 'regressions.lua', 'mock_wow.lua', 'build_release.py', 'run_sync_integration.py', 'run_target_sync.py', 'ui_regressions.lua', 'ui_release_regressions.lua', 'threat_alert_regressions.lua', 'parser_control_regressions.lua', 'window_customization_regressions.lua', 'appearance_regressions.lua', 'settings_usability_regressions.lua', 'settings_popup_regressions.lua', 'display_performance_regressions.lua', 'segment_timestamp_regressions.lua', 'overheal_regressions.lua', 'target_breakdown_regressions.lua', 'data_source_regressions.lua', 'window_state_regressions.lua', 'community_feedback_regressions.lua', 'threat_retry_regressions.lua', 'always_show_me_regressions.lua', 'threat_order_regressions.lua', 'reflect_regressions.lua', 'run_window_persistence.py', 'benchmark_display.py', 'DISPLAY_PERFORMANCE.md', 'benchmark_raw_parser.py', 'RAW_PARSER_PERFORMANCE.md'):
dst = checkout / 'tests' / src.name
dst.parent.mkdir(exist_ok=True)
shutil.copyfile(src, dst)
print(f'{archive}\n{len(files)} verified files; SHA256 {digest}\nStaged addon: {stage}')