Skip to content

Commit b9502ae

Browse files
committed
more changes
1 parent b8c4c2e commit b9502ae

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

debian/cloudstack-common.postinst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919

2020
set -e
2121
CLOUDUTILS_DIR="/usr/share/pyshared/"
22-
DIST_DIR=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
2322

24-
if which pycompile >/dev/null 2>&1; then
25-
pycompile -p cloudstack-common || echo "Warning: pycompile failed for cloudstack-common" >&2
26-
fi
23+
# distutils was removed in Python 3.12 (Ubuntu 24.04); the Debian/Ubuntu-patched
24+
# sysconfig 'deb_system' scheme gives the same /usr/lib/python3/dist-packages path.
25+
DIST_DIR=$(python3 -c "import sysconfig; print(sysconfig.get_path('platlib', 'deb_system'))")
2726

28-
if which pycompile >/dev/null 2>&1; then
29-
pycompile -p cloudstack-common /usr/share/cloudstack-common || true
27+
if command -v py3compile >/dev/null 2>&1; then
28+
py3compile -p cloudstack-common 2>/dev/null || echo "Warning: py3compile failed for cloudstack-common" >&2
29+
py3compile -p cloudstack-common /usr/share/cloudstack-common 2>/dev/null || echo "Warning: py3compile failed for cloudstack-common (/usr/share/cloudstack-common)" >&2
3030
fi
3131

3232
cp $CLOUDUTILS_DIR/cloud_utils.py $DIST_DIR

0 commit comments

Comments
 (0)