containerctl: Fix python version detection
Signed-off-by: Enno Tensing <tenno@suij.in>
This commit is contained in:
parent
259c2ec8d7
commit
589a9125f4
1 changed files with 11 additions and 17 deletions
22
containerctl
22
containerctl
|
@ -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
|
|
||||||
|
|
||||||
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
|
|
||||||
then
|
then
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
pyver=$((pyver - 1))
|
||||||
|
py="python3.${pyver}"
|
||||||
|
done
|
||||||
|
|
||||||
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
|
||||||
|
|
Loading…
Add table
Reference in a new issue