From b01e8a5c3dab645cc93257d8d299e057aea3dc58 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Tue, 22 Sep 2026 22:00:57 +0000 Subject: [PATCH] Exclude Python.Runtime.dll from UPX (packing corrupts CLR metadata) --- scripts/MediaHive.spec | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scripts/MediaHive.spec b/scripts/MediaHive.spec index 30ae419..9d36c6f 100644 --- a/scripts/MediaHive.spec +++ b/scripts/MediaHive.spec @@ -123,6 +123,11 @@ exe = EXE( windowed=True, ) +# UPX breaks .NET assemblies: packing Python.Runtime.dll strips/corrupts its +# CLR metadata and pythonnet then fails with "Failed to resolve +# Python.Runtime.Loader.Initialize from .../Python.Runtime.dll". +_upx_exclude = ["Python.Runtime.dll"] if sys.platform == "win32" else [] + coll = COLLECT( exe, a.binaries, @@ -130,7 +135,7 @@ coll = COLLECT( a.datas, strip=False, upx=True, - upx_exclude=[], + upx_exclude=_upx_exclude, name="MediaHive", )