Fix Python dependencies installation in postinst
- Add requirements.txt to debian/install - Update postinst to use requirements.txt for pip install - Install from requirements.txt instead of -e . (editable install) - Ensures bluepy and paho-mqtt are installed in venv - Fixes 'ModuleNotFoundError: No module named bluetooth' on startup
This commit is contained in:
1
debian/install
vendored
1
debian/install
vendored
@@ -1,6 +1,7 @@
|
||||
src/sensorpajen/*.py opt/sensorpajen/src/sensorpajen/
|
||||
scripts/approve-sensors.sh opt/sensorpajen/scripts/
|
||||
pyproject.toml opt/sensorpajen/
|
||||
requirements.txt opt/sensorpajen/
|
||||
readme.md usr/share/doc/sensorpajen/
|
||||
INSTALL.md usr/share/doc/sensorpajen/
|
||||
ROADMAP.md usr/share/doc/sensorpajen/
|
||||
|
||||
16
debian/postinst
vendored
16
debian/postinst
vendored
@@ -42,11 +42,19 @@ case "$1" in
|
||||
venv/bin/pip install --upgrade pip setuptools wheel
|
||||
fi
|
||||
|
||||
# Install Python dependencies from pyproject.toml
|
||||
# Install Python dependencies from requirements.txt
|
||||
echo "Installing Python dependencies..."
|
||||
venv/bin/pip install -e . || {
|
||||
echo "Warning: pip install failed. You may need to install dependencies manually."
|
||||
}
|
||||
if [ -f "/opt/sensorpajen/requirements.txt" ]; then
|
||||
venv/bin/pip install -r /opt/sensorpajen/requirements.txt
|
||||
else
|
||||
echo "Warning: requirements.txt not found, installing bluepy and paho-mqtt directly"
|
||||
venv/bin/pip install bluepy paho-mqtt
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error: Failed to install dependencies"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set Bluetooth capabilities on Python executable
|
||||
PYTHON_PATH=$(readlink -f /opt/sensorpajen/venv/bin/python3)
|
||||
|
||||
Reference in New Issue
Block a user