From 4ebdd7e27d291cd2bf764824fa09fa5e25c67445 Mon Sep 17 00:00:00 2001 From: matthew wall Date: Wed, 10 Jan 2024 23:58:59 -0500 Subject: [PATCH] provide feedback if pre-compile fails --- pkg/debian/changelog | 3 +++ pkg/debian/postinst | 15 ++++++++++----- pkg/weewx.spec.in | 6 +++++- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/pkg/debian/changelog b/pkg/debian/changelog index 0043af0e..73a7d51f 100644 --- a/pkg/debian/changelog +++ b/pkg/debian/changelog @@ -1,3 +1,6 @@ +weewx (5.0.0rc3-4) unstable; urgency=low + * fix for pre-compile fails + -- Matthew Wall (weewx) Wed, 10 Jan 2024 23:57:51 -0500 weewx (5.0.0rc3-3) unstable; urgency=low * added output to postinst to aid failure diagnostics -- Matthew Wall (weewx) Wed, 10 Jan 2024 20:24:04 -0500 diff --git a/pkg/debian/postinst b/pkg/debian/postinst index 6e125489..695af27c 100755 --- a/pkg/debian/postinst +++ b/pkg/debian/postinst @@ -231,6 +231,15 @@ merge_weewxconf() { fi } +# precompile the bytecode +precompile() { + rc=$(python3 -m compileall -q -x 'user' /usr/share/weewx) + if [ "$rc" != "" ]; then + echo "Pre-compile failed!" + echo "$rc" + fi +} + # get the version number from the specified file, without the debian revisions get_conf_version() { v=$(grep '^version.*=' $1 | sed -e 's/\s*version\s*=\s*//' | sed -e 's/-.*//') @@ -425,12 +434,8 @@ case "$1" in setup_user_dir setup_database_dir setup_reporting_dir - - # precompile the bytecode - python3 -m compileall /usr/share/weewx > /dev/null - + precompile set_permissions - enable_init $pid1 start_weewx $pid1 ;; diff --git a/pkg/weewx.spec.in b/pkg/weewx.spec.in index 5add1a15..9426bba6 100644 --- a/pkg/weewx.spec.in +++ b/pkg/weewx.spec.in @@ -148,7 +148,11 @@ fi %post precompile() { - %{python} -m compileall %{dst_code_dir} > /dev/null + rc=$(%{python} -m compileall -q -x 'user' %{dst_code_dir}) + if [ "$rc" != "" ]; then + echo "Pre-compile failed!" + echo "$rc" + fi } # get the version number from the specified file, without the rpm revisions