2
1

check-host-python3.sh 636 B

1234567891011121314151617181920212223242526272829
  1. #!/bin/sh
  2. # prevent shift error
  3. [ $# -lt 2 ] && exit 1
  4. version_min="$(echo ${1} | awk '{ split($1, v, "."); print v[1] v[2] }')"
  5. shift
  6. # We want to check the version number of the python3 interpreter even
  7. # if Buildroot is able to use any version but some packages may require
  8. # a more recent version.
  9. for candidate in "${@}" ; do
  10. python3=`which $candidate 2>/dev/null`
  11. if [ ! -x "$python3" ]; then
  12. continue
  13. fi
  14. version=`$python3 -V 2>&1 | awk '{ split($2, v, "."); print v[1] v[2] }'`
  15. if [ $version -lt $version_min ]; then
  16. # no suitable python3 found
  17. continue
  18. fi
  19. # suitable python3 found
  20. echo $python3
  21. break
  22. done