refactor(updates): pass typed runtime policy to deskup

This commit is contained in:
lingjhf committed 2026-10-06 13:38:11 +08:00
1 parent 1ef8edc8bc
commit d83f94afd5
13 files changed
+158 -102

No files matched your search

+7 -3
View File
@@ -117,9 +117,13 @@ def package_app(app, output, vpk, *, development=False, require_processing=True)
check_tool(command)
version = file_version(app)
package_id = 'Cutdex.Dev' if development else 'Cutdex'
# deskup compiles the identity into the plugin, rather than the runner.
identity = package_id.encode('ascii') + b'\0'
if identity not in (app / 'deskup_plugin.dll').read_bytes():
# The updater is generic; verify the host flavor through its PE branding.
import pefile
with pefile.PE(str(app / 'cutdex.exe')) as pe:
products = [table.entries.get(b'ProductName', b'').decode('utf-8')
for group in pe.FileInfo for block in group
if block.Key == b'StringFileInfo' for table in block.StringTable]
if ('Cutdex Dev' if development else 'Cutdex') not in products:
raise ValueError('Package identity does not match the Flutter build flavor')
validate_previous(output, package_id, version)
output.mkdir(parents=True, exist_ok=True)