1
0
Fork 0

containerctl: Fix python version detection

Signed-off-by: Enno Tensing <tenno@suij.in>
This commit is contained in:
Enno Tensing 2025-08-12 18:16:07 +02:00
parent 259c2ec8d7
commit 589a9125f4
Signed by: tenno
GPG key ID: 95265603BD36E66C

View file

@ -17,28 +17,22 @@ get_python_path()
pyver="$(/usr/bin/env "${py}" -c 'import sys; print(sys.version_info.minor)')"
if [ "${pyver}" -lt "11" ]
then
py="python3.13"
pyver="13"
py="python3.${pyver}"
else
printf '%b' "${py}"
return
fi
if /usr/bin/env "${py}" 2> /dev/null
then
return
fi
py="python3.12"
if /usr/bin/env "${py}" 2> /dev/null
then
return
fi
py="python3.11"
if /usr/bin/env "${py}" 2> /dev/null
while [ "${pyver}" -ge 11 ]
do
if /usr/bin/env "${py}" -c "print('${py}')" 2> /dev/null
then
return
fi
pyver=$((pyver - 1))
py="python3.${pyver}"
done
log_error 'containerctl needs at least Python 3.11 to run!'
exit 1