From 73e58fa18edadfcf554dfb4f7d14ce86142666fb Mon Sep 17 00:00:00 2001 From: Juwen Lie <73946469+juw12@users.noreply.github.com> Date: Sat, 21 Nov 2026 12:25:40 +0700 Subject: [PATCH] Build: a .venv made by setup.bat no longer empties Buddy.exe of its libraries --- buddy.spec | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/buddy.spec b/buddy.spec index 7618092..fd045ed 100644 --- a/buddy.spec +++ b/buddy.spec @@ -67,8 +67,15 @@ analysis = Analysis( excludes=["pytest"], ) -# Keep our own modules OUT of the frozen archive: they are imported from dist\Buddy\app at run time -analysis.pure = [entry for entry in analysis.pure if not Path(entry[1]).resolve().is_relative_to(ROOT)] +# Keep our own modules OUT of the frozen archive: they are imported from dist\Buddy\app at run time. +# The .venv that setup.bat makes is under ROOT too: its libraries (site-packages) are not ours and stay in, +# otherwise Buddy.exe is built without numpy, pystray, pynput and the rest and cannot start. +def own_source(path): + path = Path(path).resolve() + return path.is_relative_to(ROOT) and "site-packages" not in path.parts + + +analysis.pure = [entry for entry in analysis.pure if not own_source(entry[1])] pyz = PYZ(analysis.pure) exe = EXE(