@@ -14,6 +14,30 @@ function list_include_item {
1414 fi
1515}
1616
17+ function check_ldd_version {
18+ local LIBC_VER_RAW=$( ldd --version | head -1)
19+ echo " LIBC version: $LIBC_VER_RAW "
20+ if ! [[ $LIBC_VER_RAW =~ ([[:digit:]]+)\. ([[:digit:]]+) ]]; then
21+ echo " Could not match LIBC version! Not sure what's going on."
22+ return 1
23+ fi
24+ local LIBC_VER_ALL=${BASH_REMATCH[0]}
25+ local LIBC_VER_MAJ=${BASH_REMATCH[1]}
26+ local LIBC_VER_MIN=${BASH_REMATCH[2]}
27+
28+ # Only support libc 2
29+ if ! list_include_item ' 2' $LIBC_VER_MAJ ; then
30+ echo " LIBC major version $LIBC_VER_MAJ ($LIBC_VER_ALL ) is not supported"
31+ return 1
32+ fi
33+ # Only support >= 28
34+ if [ " $LIBC_VER_MIN " -lt 28 ]; then
35+ echo " LIBC minor version $LIBC_VER_MIN ($LIBC_VER_ALL ) is not supported"
36+ return 1
37+ fi
38+ return 0
39+ }
40+
1741function check_py_version {
1842 local PY_VER_RAW=$( $PYTHON --version)
1943 echo " Python version: $PY_VER_RAW "
@@ -31,15 +55,23 @@ function check_py_version {
3155 echo " Python major version $PY_VER_MAJ ($PY_VER_ALL ) is not supported"
3256 return 1
3357 fi
34- # Only support 3.6 +
35- if ! list_include_item ' 6 7 8 9 10 11' $PY_VER_MIN ; then
58+ # Only support 3.7 +
59+ if ! list_include_item ' 7 8 9 10 11' $PY_VER_MIN ; then
3660 echo " Python minor version $PY_VER_MIN ($PY_VER_ALL ) is not supported"
3761 return 1
3862 fi
3963 return 0
4064}
4165
4266function set_supported_python_path {
67+ if [ -n " ${PYTHON+x} " ]; then
68+ # PYTHON is being set from the CLI
69+ echo " PYTHON overridden: $PYTHON "
70+ if check_py_version; then
71+ return 0
72+ fi
73+ echo " Overridden PYTHON not supported. Checking system python versions."
74+ fi
4375 # Check the that one of (python, python3) is supported
4476 if ! command -v python3 > /dev/null; then
4577 # ok, python3 not available. Try python
@@ -70,6 +102,10 @@ function set_supported_python_path {
70102}
71103
72104# Main script logic
105+ if ! check_ldd_version; then
106+ echo " Unsupported LIBC version, sorry :/"
107+ exit 1
108+ fi
73109set_supported_python_path # This sets $PYTHON
74110echo " Python command is $PYTHON "
75111# check venv is available
0 commit comments