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