feat: Enhance Python environment detection in build scripts and improve project root resolution in PyInstaller spec
Some checks are pending
Tests & Quality Checks / Test on Python 3.11 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-1 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.10 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.11-2 (push) Waiting to run
Tests & Quality Checks / Test on Python 3.12-2 (push) Waiting to run
Tests & Quality Checks / Build Artifacts (push) Blocked by required conditions
Tests & Quality Checks / Build Artifacts-1 (push) Blocked by required conditions

This commit is contained in:
claudi 2026-04-14 15:07:33 +02:00
parent 93316c7e2f
commit a539b91762
2 changed files with 40 additions and 7 deletions

View file

@ -11,8 +11,29 @@ import os
project_root = Path.cwd()
if not (project_root / "src").exists():
project_root = Path(__file__).resolve().parents[1]
env_root = os.environ.get("WEBDROP_PROJECT_ROOT")
if env_root:
candidate = Path(env_root).resolve()
if (candidate / "src").exists():
project_root = candidate
if not (project_root / "src").exists():
# PyInstaller exposes SPECPATH while evaluating spec files.
spec_path = globals().get("SPECPATH")
if spec_path:
spec_candidate = Path(spec_path).resolve()
for candidate in (spec_candidate, spec_candidate.parent):
if (candidate / "src").exists():
project_root = candidate
break
if not (project_root / "src").exists():
raise SystemExit(
"Unable to determine project root for PyInstaller spec. "
"Run from repository root or set WEBDROP_PROJECT_ROOT."
)
pathex = [str(project_root / "src")]
entry_script = str(project_root / "src" / "webdrop_bridge" / "main.py")