#!/usr/bin/env python3 """Vendor the selected AVA2 interfaces as embedded Python. Re-run after reference updates.""" from pathlib import Path import hashlib,json ROOT=Path(__file__).resolve().parents[2] REF=ROOT.parent/'AVA2/1. Client DEV/pack_maker/root' SOURCES={'ItemShopNew':'uiitemshopnew.py','BattlePassEx':'uibattlepassex.py','EventCalendarNew':'uieventcalendarnew.py','WikiUI':'wikiui.py','Wiki':'uiwiki.py','DropItem':'uidropitem.py'} manifest={} for label,name in SOURCES.items(): raw=(REF/name).read_bytes();s=raw.decode('cp1254').replace('\r\n','\n') manifest[name]={'sha256':hashlib.sha256(raw).hexdigest(),'module':label,'changes':['CP1254 to UTF-8','CRLF to LF']} (ROOT/'src/platform/ScriptLib'/('Ava2'+label+'Source.inc')).write_text('// AVA2 original '+name+'; generated by tools/ava2-native/import_sources.py.\nstatic const char c_szAva2'+label+'Source[] = R"PY(# -*- coding: utf-8 -*-\n'+s+'\n)PY";\n') (ROOT/'tools/ava2-native/sources.json').write_text(json.dumps(manifest,indent=2)+'\n')