provide feedback if pre-compile fails

This commit is contained in:
matthew wall
2024-01-10 23:58:59 -05:00
parent 89282e4dbd
commit 4ebdd7e27d
3 changed files with 18 additions and 6 deletions

View File

@@ -1,3 +1,6 @@
weewx (5.0.0rc3-4) unstable; urgency=low
* fix for pre-compile fails
-- Matthew Wall (weewx) <mwall@users.sourceforge.net> 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) <mwall@users.sourceforge.net> Wed, 10 Jan 2024 20:24:04 -0500

View File

@@ -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
;;

View File

@@ -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