Skip to content

BuzzInstaller FIXES

Choose a tag to compare

@MapleSyrupLover MapleSyrupLover released this 07 Aug 23:12
· 3 commits to master since this release

Summary of All Changes

Part 1: PyInstaller _MEI Cleanup Fix (3 files)

Root cause: When BuzzInstaller.exe (PyInstaller onefile) spawns the --background process via subprocess.Popen([sys.executable, "--background"]), the child inherits the _MEIPASS2 environment variable set by the parent's C bootloader. The child's bootloader sees _MEIPASS2 already set and reuses the parent's _MEI* extraction directory instead of extracting its own copy. The background process is intentionally long-lived, keeping Qt DLLs loaded from the parent's _MEI* directory — locking it. When the foreground exits, PyInstaller's cleanup fails.

1. src/BuzzInstaller/system/background_service.py — PRIMARY FIX

  • Strips _MEIPASS2 from the child's environment when spawning subprocesses while frozen, forcing the child to extract its own _MEI* directory.

2. src/BuzzInstaller/core/buzzheavier_api.py — NETWORK CLEANUP

  • Added BuzzHeavierAPI.close() to release the requests.Session (connection pools/sockets).
  • Fixed get_download_url() to properly close HTTP responses with resp.close() in a finally block.

3. src/BuzzInstaller/main.py — SHUTDOWN LOGGING + CLEANUP

  • run_upload(): Added service.api.close() in worker's finally block, thread join after app.exec().
  • run_download(): Added worker_done Event, service.api.close() in finally block, thread join.
  • main() background mode: Added shutdown logging around svc.run() and svc.stop().
  • __main__: Added exit logging.

Part 2: Shortcut Creation (2 new files, 1 modified)

4. src/BuzzInstallerInstaller/shortcut.py — NEW FILE

  • create_shortcut(exe_path, shortcut_path) — Creates/updates a real .lnk file using PowerShell's WScript.Shell COM object.
  • delete_shortcut(shortcut_path) — Removes a shortcut.
  • get_shortcut_target(shortcut_path) — Reads the target of an existing shortcut.

5. src/BuzzInstallerInstaller/installer.py — SHORTCUT INTEGRATION

  • create_shortcut_for_installed() — Creates C:\BuzzInstaller\BuzzInstaller.lnk after install/update.
  • delete_buzzinstaller() — Removes the shortcut on delete (only removes C:\BuzzInstaller dir if empty).
  • Installer.run() — Creates shortcut after successful install/update (best-effort, non-fatal on failure).

6. src/BuzzInstallerInstaller/tests/test_shortcut.py — NEW FILE

  • 13 tests covering: create, update, target path, working directory, permission failure, delete, missing shortcut, installer integration, unrelated file preservation.

Test Results

  • test_version.py: 10/10 PASS
  • test_installer.py: 24/24 PASS
  • test_improvements.py: 19/19 PASS
  • test_shortcut.py: 13/13 PASS
  • Total: 66/66 tests PASS
  • One-file PyInstaller build: SUCCESS (256 MB executable)