Copilot commented on code in PR #13602:
URL: https://github.com/apache/cloudstack/pull/13602#discussion_r3577034969
##########
debian/cloudstack-common.postinst:
##########
@@ -19,14 +19,17 @@
set -e
CLOUDUTILS_DIR="/usr/share/pyshared/"
-DIST_DIR=$(python3 -c "from distutils.sysconfig import get_python_lib;
print(get_python_lib(1))")
-if which pycompile >/dev/null 2>&1; then
- pycompile -p cloudstack-common
+# distutils was removed in Python 3.12 (Ubuntu 24.04); the
Debian/Ubuntu-patched
+# sysconfig 'deb_system' scheme gives the same /usr/lib/python3/dist-packages
path.
+DIST_DIR=$(python3 -c "import sysconfig; print(sysconfig.get_path('platlib',
'deb_system'))")
+
+if command -v py3compile >/dev/null 2>&1; then
+ py3compile -p cloudstack-common 2>/dev/null || echo "Warning: py3compile
failed for cloudstack-common" >&2
fi
-if which pycompile >/dev/null 2>&1; then
- pycompile -p cloudstack-common /usr/share/cloudstack-common
+if command -v py3compile >/dev/null 2>&1; then
Review Comment:
The `py3compile` presence check is duplicated, and stderr is discarded
(`2>/dev/null`), which makes the emitted warning less actionable (the
underlying error output is lost). Consider a single `if` block and keep
`py3compile` output while still ignoring its exit status.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]