From a55d065c38d8744bb66e1cafa98c661889aff91b Mon Sep 17 00:00:00 2001 From: Fredrik Wahlberg Date: Sun, 28 Dec 2025 10:42:16 +0100 Subject: [PATCH] Add bytecode cleanup to postinst before building wheel Remove stale .pyc files and __pycache__ directories before installing the sensorpajen package to ensure Python rebuilds bytecode fresh. This should prevent cached bytecode issues from old syntax errors. --- debian/postinst | 3 +++ debian/sensorpajen/DEBIAN/postinst | 3 +++ 2 files changed, 6 insertions(+) diff --git a/debian/postinst b/debian/postinst index 526edbb..275ec3e 100755 --- a/debian/postinst +++ b/debian/postinst @@ -64,6 +64,9 @@ case "$1" in # Install sensorpajen package itself echo "Installing sensorpajen application..." cd /opt/sensorpajen + # Clean up any stale bytecode before building wheel + find . -name "*.pyc" -delete + find . -name "__pycache__" -type d -delete venv/bin/pip install --no-deps . || { echo "Error: Failed to install sensorpajen package" exit 1 diff --git a/debian/sensorpajen/DEBIAN/postinst b/debian/sensorpajen/DEBIAN/postinst index 526edbb..275ec3e 100755 --- a/debian/sensorpajen/DEBIAN/postinst +++ b/debian/sensorpajen/DEBIAN/postinst @@ -64,6 +64,9 @@ case "$1" in # Install sensorpajen package itself echo "Installing sensorpajen application..." cd /opt/sensorpajen + # Clean up any stale bytecode before building wheel + find . -name "*.pyc" -delete + find . -name "__pycache__" -type d -delete venv/bin/pip install --no-deps . || { echo "Error: Failed to install sensorpajen package" exit 1