From fd3f8249d5da3718128a888694aa00717582c19e Mon Sep 17 00:00:00 2001 From: mck Date: Wed, 21 May 2025 22:10:16 +0200 Subject: [PATCH] Fix cassandra-cqlsh-tests.sh on python <= 3.8 patch by Mick Semb Wever; reviewed by Brandon Williams for CASSANDRA-20669 --- pylib/cassandra-cqlsh-tests.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pylib/cassandra-cqlsh-tests.sh b/pylib/cassandra-cqlsh-tests.sh index b2d2c500ae..c37a1c32ae 100755 --- a/pylib/cassandra-cqlsh-tests.sh +++ b/pylib/cassandra-cqlsh-tests.sh @@ -81,8 +81,13 @@ fi set -e # enable immediate exit if venv setup fails virtualenv --python=$PYTHON_VERSION venv source venv/bin/activate -# 3.11 needs the newest pip -curl -sS https://bootstrap.pypa.io/get-pip.py | $PYTHON_VERSION +# 3.11 needs the newest pip, 3.8 and older have specific legacy get-pip urls +PYTHON_MAJOR_MINOR=$($PYTHON_VERSION -V 2>&1 | awk '{print $2}' | cut -d. -f1,2) +if [[ "$(printf '%s\n' "$PYTHON_MAJOR_MINOR" "3.8" | sort -V | head -n1)" == "$PYTHON_MAJOR_MINOR" ]]; then + curl -sS https://bootstrap.pypa.io/pip/${PYTHON_MAJOR_MINOR}/get-pip.py | $PYTHON_VERSION +else + curl -sS https://bootstrap.pypa.io/get-pip.py | $PYTHON_VERSION +fi pip install -r ${CASSANDRA_DIR}/pylib/requirements.txt pip freeze