SQUASH – cqlsh-test fixes (not complete)

Force pip's legacy pkg_resources metadata backend (instead of the importlib.metadata
 backend that pip defaults to on Python 3.11+). When pip reinstalls the editable VCS
 cassandra-driver it git-checks-out over the existing src/cassandra-driver tree, removing
 its egg-info mid-resolution. The importlib backend then reads a version-less editable dist
 and crashes with "TypeError: expected string or bytes-like object, got 'NoneType'", whereas
 the legacy backend tolerates the missing metadata.
 (Requires pip < 25.1, which still ships the pkg_resources backend. See ubuntu-test.docker)
This commit is contained in:
mck 2026-06-12 22:37:46 +02:00 committed by Arvind Kandpal
parent d8c3ca33fd
commit ddeb2534ad
4 changed files with 16 additions and 6 deletions

View File

@ -300,6 +300,7 @@ echo "Running container ${container_name} ${docker_id} using image ${image_name}
docker exec --user root ${container_name} bash -c "\${CASSANDRA_DIR}/.build/docker/_create_user.sh cassandra $(id -u) $(id -g)" | tee -a ${logfile}
docker exec --user root ${container_name} update-alternatives --set python /usr/bin/python${python_version} | tee -a ${logfile}
docker exec --user root ${container_name} update-alternatives --set python3 /usr/bin/python${python_version} | tee -a ${logfile}
if [ -n "${DTEST_TMPDIR_LOCAL}" ] && [[ "${target}" =~ ^dtest-upgrade ]] ; then
# prepopulate a tmp ccm repository directory, if running dtest-upgrade tests

View File

@ -60,10 +60,15 @@ RUN export DEBIAN_FRONTEND=noninteractive && \
RUN update-alternatives --remove java /usr/lib/jvm/java-8-openjdk-$(dpkg --print-architecture)/jre/bin/java
RUN update-alternatives --install /usr/bin/java java /usr/lib/jvm/java-8-openjdk-$(dpkg --print-architecture)/bin/java 1081
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 2
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 3
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.12 4
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.13 5
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.10 1
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.11 1
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.12 1
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.13 1
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 1
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.12 1
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.13 1
RUN python3.8 -m pip install --upgrade pip
# generate locales for the standard en_US.UTF8 value we use for testing

View File

@ -24,8 +24,6 @@
set -o errexit
set -o pipefail
[ $DEBUG ] && set -x
# variables, with defaults
[ "x${CASSANDRA_DIR}" != "x" ] || CASSANDRA_DIR="$(readlink -f $(dirname -- "$0")/..)"
[ "x${DIST_DIR}" != "x" ] || DIST_DIR="${CASSANDRA_DIR}/build"

View File

@ -23,6 +23,8 @@
#
################################
[ $DEBUG ] && set -x
WORKSPACE=$1
[ "x${WORKSPACE}" != "x" ] || WORKSPACE="$(readlink -f $(dirname "$0")/..)"
@ -63,6 +65,10 @@ rm -fr ${DIST_DIR}/venv ${DIST_DIR}/test/{html,output,logs}
virtualenv-clone ${BUILD_HOME}/env${python_version} ${BUILD_DIR}/venv || virtualenv --python=python3 ${BUILD_DIR}/venv
source ${BUILD_DIR}/venv/bin/activate
# Force pip's legacy pkg_resources metadata backend (instead of the importlib.metadata
# backend that pip defaults to on Python 3.11+). see ubuntu-test.docker
export _PIP_USE_IMPORTLIB_METADATA=0
pip install --exists-action w -r ${CASSANDRA_DIR}/pylib/requirements.txt
pip freeze