From 291318f57c83dd9b62c9a0287fdc8e6341ec787e Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 6 Aug 2025 16:39:13 -0500 Subject: [PATCH] DRIVERS-3249 fix pymongo compat with server version 4.0 and older --- .evergreen/install-cli.sh | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/.evergreen/install-cli.sh b/.evergreen/install-cli.sh index eae0c695..2f72ccf9 100755 --- a/.evergreen/install-cli.sh +++ b/.evergreen/install-cli.sh @@ -99,25 +99,32 @@ uv venv venv &>/dev/null popd >/dev/null # $SCRIPT_DIR pushd "$TARGET_DIR" >/dev/null -# Add support for MongoDB 3.6, which was dropped in pymongo 4.11. -EXTRA_ARGS="" -if [ "${MONGODB_VERSION:-latest}" == "3.6" ]; then - EXTRA_ARGS_ARR=(--with "pymongo<4.11") - EXTRA_ARGS="${EXTRA_ARGS_ARR[*]}" -fi +declare uv_install_args +uv_install_args=( + --quiet + --force + --editable + --with certifi +) + +# Preserve pymongo compatibility with the requested server version. +case "${MONGODB_VERSION:-"latest"}" in +3.6) uv_install_args+=(--with "pymongo<4.11") ;; +4.0) uv_install_args+=(--with "pymongo<4.14") ;; +esac # On Windows, we have to do a bit of path manipulation. if [ "Windows_NT" == "${OS:-}" ]; then TMP_DIR=$(cygpath -m "$(mktemp -d)") PATH="$SCRIPT_DIR/venv/Scripts:$PATH" - UV_TOOL_BIN_DIR=${TMP_DIR} uv tool install -q ${EXTRA_ARGS} --with certifi --force --editable . + UV_TOOL_BIN_DIR=${TMP_DIR} uv tool install "${uv_install_args[@]:?}" . filenames=$(ls ${TMP_DIR}) for filename in $filenames; do mv $TMP_DIR/$filename "$1/${filename//.exe/}" done rm -rf $TMP_DIR else - UV_TOOL_BIN_DIR=$(pwd) uv tool install -q ${EXTRA_ARGS} --with certifi --force --editable . + UV_TOOL_BIN_DIR=$(pwd) uv tool install "${uv_install_args[@]:?}" . fi popd >/dev/null # "$TARGET_DIR"