From 3bb8627d209c0d8f91eebbda79baedfa37009f31 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Mon, 16 Mar 2026 09:11:23 -0400 Subject: [PATCH] fix(install): restrict vendor sys.path and PyInstaller imports to frozen builds only (v0.2.15) The vendor directory was unconditionally prepended to sys.path, causing pip/pipx installs to load incomplete vendored setuptools (missing data files like Lorem ipsum.txt) instead of the system package. Now the vendor path is only added for PyInstaller frozen builds, and the force-import block in cli.py is similarly guarded behind sys.frozen. Co-Authored-By: Claude Opus 4.6 --- pyproject.toml | 2 +- voxvera/__init__.py | 14 +++++--------- voxvera/cli.py | 21 ++++++++++++--------- 3 files changed, 18 insertions(+), 19 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5b48a1f..1257f95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -14,7 +14,7 @@ voxvera = ["templates/**", "src/**", "resources/**", "locales/**", "resources/bi [project] name = "voxvera" -version = "0.2.14" +version = "0.2.15" description = "VoxVera CLI utilities" readme = "README.md" authors = [{name = "VoxVera"}] diff --git a/voxvera/__init__.py b/voxvera/__init__.py index 3199214..fc38696 100644 --- a/voxvera/__init__.py +++ b/voxvera/__init__.py @@ -1,16 +1,12 @@ import sys from pathlib import Path -__version__ = "0.2.13" +__version__ = "0.2.15" -# Add the vendor directory to sys.path. We prepend it to ensure our bundled -# dependencies take priority over potentially incompatible system packages -# (e.g. Flask/Werkzeug version mismatches on Debian). +# Add the vendor directory to sys.path ONLY for PyInstaller (frozen) builds. +# For pip/pipx installs the system/venv packages are correct and the vendored +# copies are incomplete (missing data files), so we must not shadow them. if getattr(sys, 'frozen', False): vendor_dir = Path(sys._MEIPASS).joinpath("voxvera", "vendor") -else: - vendor_dir = Path(__file__).parent / "vendor" - -if vendor_dir.exists(): - if str(vendor_dir) not in sys.path: + if vendor_dir.exists() and str(vendor_dir) not in sys.path: sys.path.insert(0, str(vendor_dir)) diff --git a/voxvera/cli.py b/voxvera/cli.py index 657dc73..538e7e3 100644 --- a/voxvera/cli.py +++ b/voxvera/cli.py @@ -11,15 +11,18 @@ from pathlib import Path from importlib import resources from importlib.resources.abc import Traversable -# Force PyInstaller to bundle these critical dependencies for onionshare-cli -try: - import pkg_resources - import setuptools - import jaraco - import platformdirs - import packaging -except ImportError: - pass +# Force PyInstaller to bundle these critical dependencies for onionshare-cli. +# Only needed at freeze-time analysis; skip for normal pip/pipx installs to +# avoid pulling in vendored copies that may be incomplete. +if getattr(sys, 'frozen', False): + try: + import pkg_resources + import setuptools + import jaraco + import platformdirs + import packaging + except Exception: + pass from InquirerPy import prompt, inquirer from rich.console import Console