2019-03-12 23:35:24 +01:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# prevent shift error
|
|
|
|
[ $# -lt 2 ] && exit 1
|
|
|
|
|
|
|
|
version_min="$(echo ${1} | awk '{ split($1, v, "."); print v[1] v[2] }')"
|
|
|
|
|
|
|
|
shift
|
|
|
|
|
|
|
|
# The host python interpreter is already checked by dependencies.sh but
|
|
|
|
# it only check if the version is at least 2.7.
|
|
|
|
# We want to check the version number of the python3 interpreter even
|
|
|
|
# if Buildroot is able to use any version but some packages may require
|
|
|
|
# a more recent version.
|
|
|
|
|
|
|
|
for candidate in "${@}" ; do
|
2021-10-01 20:08:32 +02:00
|
|
|
python3=`which $candidate 2>/dev/null`
|
2019-03-12 23:35:24 +01:00
|
|
|
if [ ! -x "$python3" ]; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
version=`$python3 -V 2>&1 | awk '{ split($2, v, "."); print v[1] v[2] }'`
|
|
|
|
|
|
|
|
if [ $version -lt $version_min ]; then
|
|
|
|
# no suitable python3 found
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
# suitable python3 found
|
|
|
|
echo $python3
|
|
|
|
break
|
|
|
|
done
|