fix: add app/src to embedded Python ._pth for module discovery
Some checks failed
Build Release / create-release (push) Successful in 1s
Build Release / build-windows (push) Successful in 1m14s
Lint & Test / test (push) Successful in 1m50s
Build Release / build-docker (push) Failing after 46s
Build Release / build-linux (push) Successful in 1m37s
Some checks failed
Build Release / create-release (push) Successful in 1s
Build Release / build-windows (push) Successful in 1m14s
Lint & Test / test (push) Successful in 1m50s
Build Release / build-docker (push) Failing after 46s
Build Release / build-linux (push) Successful in 1m37s
Windows embedded Python ignores PYTHONPATH when a ._pth file exists. Add ../app/src to the ._pth so wled_controller is importable. Fixes ModuleNotFoundError on portable builds.
This commit is contained in:
@@ -73,11 +73,16 @@ if [ -z "$PTH_FILE" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Uncomment 'import site' and add Lib\site-packages
|
||||
# Uncomment 'import site', add Lib\site-packages and app source path
|
||||
sed -i 's/^#\s*import site/import site/' "$PTH_FILE"
|
||||
if ! grep -q 'Lib\\site-packages' "$PTH_FILE"; then
|
||||
echo 'Lib\site-packages' >> "$PTH_FILE"
|
||||
fi
|
||||
# Embedded Python ._pth overrides PYTHONPATH, so we must add the app
|
||||
# source directory here for wled_controller to be importable
|
||||
if ! grep -q '\.\./app/src' "$PTH_FILE"; then
|
||||
echo '../app/src' >> "$PTH_FILE"
|
||||
fi
|
||||
echo " Patched $(basename "$PTH_FILE")"
|
||||
|
||||
# ── Download pip and install into embedded Python ────────────
|
||||
|
||||
Reference in New Issue
Block a user