Copilot commented on code in PR #13207: URL: https://github.com/apache/cloudstack/pull/13207#discussion_r3280040053
########## debian/cloudstack-common.postinst: ########## @@ -21,12 +21,12 @@ 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 +if which py3compile >/dev/null 2>&1; then + py3compile -p cloudstack-common fi -if which pycompile >/dev/null 2>&1; then - pycompile -p cloudstack-common /usr/share/cloudstack-common +if which py3compile >/dev/null 2>&1; then + py3compile -p cloudstack-common /usr/share/cloudstack-common Review Comment: Using `py3compile` on the `cloudstack-common` package (and especially on `/usr/share/cloudstack-common`) is likely to fail because this package installs Python 2-only scripts (e.g. `scripts/network/exdhcp/dhcpd_edithosts.py` uses Python 2 `print`/exception syntax). `py3compile` runs Python 3 byte-compilation and will raise `SyntaxError`, which (with `set -e`) can abort the package install/upgrade. Consider removing these `py3compile` calls or restricting compilation to the Python 3-only modules you copy into `$DIST_DIR` (or alternatively migrate the installed scripts to Python 3 before compiling them). ########## debian/cloudstack-common.postinst: ########## @@ -21,12 +21,12 @@ 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 +if which py3compile >/dev/null 2>&1; then Review Comment: `which` is less portable in maintainer scripts than the POSIX shell builtin `command -v` (used elsewhere in the repo’s shell scripts). Switching this check to `command -v py3compile >/dev/null 2>&1` avoids reliance on an external `which` binary. -- 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]
