Skip to content

Commit a332144

Browse files
authored
DRIVERS-3249 fix pymongo compat with server version 4.0 and older (#676)
1 parent 826e079 commit a332144

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

.evergreen/install-cli.sh

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -99,25 +99,32 @@ uv venv venv &>/dev/null
9999
popd >/dev/null # $SCRIPT_DIR
100100
pushd "$TARGET_DIR" >/dev/null
101101

102-
# Add support for MongoDB 3.6, which was dropped in pymongo 4.11.
103-
EXTRA_ARGS=""
104-
if [ "${MONGODB_VERSION:-latest}" == "3.6" ]; then
105-
EXTRA_ARGS_ARR=(--with "pymongo<4.11")
106-
EXTRA_ARGS="${EXTRA_ARGS_ARR[*]}"
107-
fi
102+
declare uv_install_args
103+
uv_install_args=(
104+
--quiet
105+
--force
106+
--editable
107+
--with certifi
108+
)
109+
110+
# Preserve pymongo compatibility with the requested server version.
111+
case "${MONGODB_VERSION:-"latest"}" in
112+
3.6) uv_install_args+=(--with "pymongo<4.11") ;;
113+
4.0) uv_install_args+=(--with "pymongo<4.14") ;;
114+
esac
108115

109116
# On Windows, we have to do a bit of path manipulation.
110117
if [ "Windows_NT" == "${OS:-}" ]; then
111118
TMP_DIR=$(cygpath -m "$(mktemp -d)")
112119
PATH="$SCRIPT_DIR/venv/Scripts:$PATH"
113-
UV_TOOL_BIN_DIR=${TMP_DIR} uv tool install -q ${EXTRA_ARGS} --with certifi --force --editable .
120+
UV_TOOL_BIN_DIR=${TMP_DIR} uv tool install "${uv_install_args[@]:?}" .
114121
filenames=$(ls ${TMP_DIR})
115122
for filename in $filenames; do
116123
mv $TMP_DIR/$filename "$1/${filename//.exe/}"
117124
done
118125
rm -rf $TMP_DIR
119126
else
120-
UV_TOOL_BIN_DIR=$(pwd) uv tool install -q ${EXTRA_ARGS} --with certifi --force --editable .
127+
UV_TOOL_BIN_DIR=$(pwd) uv tool install "${uv_install_args[@]:?}" .
121128
fi
122129

123130
popd >/dev/null # "$TARGET_DIR"

0 commit comments

Comments
 (0)