From 5525c7705838a63b31d21816e9b85ceaf453ed7e Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Apr 2025 21:14:37 -0500 Subject: [PATCH 01/23] update lockfile --- .evergreen/scripts/install-dependencies.sh | 21 +++++++++++++++++++-- uv.lock | 1 - 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.evergreen/scripts/install-dependencies.sh b/.evergreen/scripts/install-dependencies.sh index 780d250a2b..67371c7251 100755 --- a/.evergreen/scripts/install-dependencies.sh +++ b/.evergreen/scripts/install-dependencies.sh @@ -37,6 +37,23 @@ function _pip_install() { echo "Installing $2 using pip... done." } +# Try to use the binaries in the toolchain if available. +if [ -n "${CI}" ]; then + export PATH + case "${OSTYPE:?}" in + cygwin) + PATH="/cygdrive/c/Python/Current:${PATH:-}" + ;; + darwin*) + PATH="/Library/Frameworks/Python.Framework/Versions/Current/bin:${PATH:-}" + ;; + *) + PATH="/opt/python/Current/bin:${PATH:-}" + ;; + esac + fi +fi + # Ensure just is installed. if ! command -v just >/dev/null 2>&1; then @@ -53,8 +70,8 @@ if ! command -v just >/dev/null 2>&1; then echo "Installing just... done." fi -# Install uv. -if ! command -v uv >/dev/null 2>&1; then +# Fall back to installing uv. +if [ ! command -v uv >/dev/null 2>&1 ]; then echo "Installing uv..." # On most systems we can install directly. curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR="$_BIN_DIR" INSTALLER_NO_MODIFY_PATH=1 sh || { diff --git a/uv.lock b/uv.lock index 6bc0839795..aa23663a84 100644 --- a/uv.lock +++ b/uv.lock @@ -998,7 +998,6 @@ sdist = { url = "https://files.pythonhosted.org/packages/07/e9/ae44ea7d7605df9e5 [[package]] name = "pymongo" -version = "4.13.0.dev0" source = { editable = "." } dependencies = [ { name = "dnspython" }, From de30bfed488624789007ddbd185107b90c2d1ca4 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Apr 2025 21:16:01 -0500 Subject: [PATCH 02/23] syntax --- .evergreen/scripts/install-dependencies.sh | 28 ++++++++++------------ 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/.evergreen/scripts/install-dependencies.sh b/.evergreen/scripts/install-dependencies.sh index 67371c7251..c6684e96af 100755 --- a/.evergreen/scripts/install-dependencies.sh +++ b/.evergreen/scripts/install-dependencies.sh @@ -39,22 +39,20 @@ function _pip_install() { # Try to use the binaries in the toolchain if available. if [ -n "${CI}" ]; then - export PATH - case "${OSTYPE:?}" in - cygwin) - PATH="/cygdrive/c/Python/Current:${PATH:-}" - ;; - darwin*) - PATH="/Library/Frameworks/Python.Framework/Versions/Current/bin:${PATH:-}" - ;; - *) - PATH="/opt/python/Current/bin:${PATH:-}" - ;; - esac - fi + export PATH + case "${OSTYPE:?}" in + cygwin) + PATH="/cygdrive/c/Python/Current:${PATH:-}" + ;; + darwin*) + PATH="/Library/Frameworks/Python.Framework/Versions/Current/bin:${PATH:-}" + ;; + *) + PATH="/opt/python/Current/bin:${PATH:-}" + ;; + esac fi - # Ensure just is installed. if ! command -v just >/dev/null 2>&1; then # On most systems we can install directly. @@ -71,7 +69,7 @@ if ! command -v just >/dev/null 2>&1; then fi # Fall back to installing uv. -if [ ! command -v uv >/dev/null 2>&1 ]; then +if ! command -v uv >/dev/null 2>&1; then echo "Installing uv..." # On most systems we can install directly. curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR="$_BIN_DIR" INSTALLER_NO_MODIFY_PATH=1 sh || { From 31287adbbe116e074b56a500b57b62f03210b530 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Apr 2025 21:25:01 -0500 Subject: [PATCH 03/23] debug --- .evergreen/scripts/install-dependencies.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.evergreen/scripts/install-dependencies.sh b/.evergreen/scripts/install-dependencies.sh index c6684e96af..600114f46a 100755 --- a/.evergreen/scripts/install-dependencies.sh +++ b/.evergreen/scripts/install-dependencies.sh @@ -39,6 +39,7 @@ function _pip_install() { # Try to use the binaries in the toolchain if available. if [ -n "${CI}" ]; then + echo "HELLO"! export PATH case "${OSTYPE:?}" in cygwin) @@ -52,6 +53,7 @@ if [ -n "${CI}" ]; then ;; esac fi +ls /Library/Frameworks/Python.Framework/Versions/ # Ensure just is installed. if ! command -v just >/dev/null 2>&1; then From d42b5a24ecc32f1e199530dfbc226328877cd9f2 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Apr 2025 21:28:17 -0500 Subject: [PATCH 04/23] more debug --- .evergreen/scripts/install-dependencies.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.evergreen/scripts/install-dependencies.sh b/.evergreen/scripts/install-dependencies.sh index 600114f46a..8ed7a7ccb0 100755 --- a/.evergreen/scripts/install-dependencies.sh +++ b/.evergreen/scripts/install-dependencies.sh @@ -53,7 +53,11 @@ if [ -n "${CI}" ]; then ;; esac fi +set -x ls /Library/Frameworks/Python.Framework/Versions/ +which uv +echo "$PATH" +exit 1 # Ensure just is installed. if ! command -v just >/dev/null 2>&1; then From ae60535f6cb3b96b1f898c20151f39f55ed88467 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Apr 2025 21:30:57 -0500 Subject: [PATCH 05/23] hoist --- .evergreen/scripts/install-dependencies.sh | 22 ---------------------- .evergreen/scripts/setup-dev-env.sh | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/.evergreen/scripts/install-dependencies.sh b/.evergreen/scripts/install-dependencies.sh index 8ed7a7ccb0..b5accea24e 100755 --- a/.evergreen/scripts/install-dependencies.sh +++ b/.evergreen/scripts/install-dependencies.sh @@ -37,28 +37,6 @@ function _pip_install() { echo "Installing $2 using pip... done." } -# Try to use the binaries in the toolchain if available. -if [ -n "${CI}" ]; then - echo "HELLO"! - export PATH - case "${OSTYPE:?}" in - cygwin) - PATH="/cygdrive/c/Python/Current:${PATH:-}" - ;; - darwin*) - PATH="/Library/Frameworks/Python.Framework/Versions/Current/bin:${PATH:-}" - ;; - *) - PATH="/opt/python/Current/bin:${PATH:-}" - ;; - esac -fi -set -x -ls /Library/Frameworks/Python.Framework/Versions/ -which uv -echo "$PATH" -exit 1 - # Ensure just is installed. if ! command -v just >/dev/null 2>&1; then # On most systems we can install directly. diff --git a/.evergreen/scripts/setup-dev-env.sh b/.evergreen/scripts/setup-dev-env.sh index 6e6b5965bd..da45ad6398 100755 --- a/.evergreen/scripts/setup-dev-env.sh +++ b/.evergreen/scripts/setup-dev-env.sh @@ -16,6 +16,23 @@ if [ -f $HERE/test-env.sh ]; then . $HERE/test-env.sh fi +# Try to use the binaries in the toolchain if available. +if [ -n "${CI}" ]; then + echo "HELLO"! + export PATH + case "${OSTYPE:?}" in + cygwin) + PATH="/cygdrive/c/Python/Current:${PATH:-}" + ;; + darwin*) + PATH="/Library/Frameworks/Python.Framework/Versions/Current/bin:${PATH:-}" + ;; + *) + PATH="/opt/python/Current/bin:${PATH:-}" + ;; + esac +fi + # Ensure dependencies are installed. bash $HERE/install-dependencies.sh From 97df01af797ecf5455d23c4d64c8b3fb25bfd532 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Sat, 19 Apr 2025 21:35:14 -0500 Subject: [PATCH 06/23] cleanup --- .evergreen/scripts/setup-dev-env.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.evergreen/scripts/setup-dev-env.sh b/.evergreen/scripts/setup-dev-env.sh index da45ad6398..78e12adb41 100755 --- a/.evergreen/scripts/setup-dev-env.sh +++ b/.evergreen/scripts/setup-dev-env.sh @@ -16,9 +16,8 @@ if [ -f $HERE/test-env.sh ]; then . $HERE/test-env.sh fi -# Try to use the binaries in the toolchain if available. +# Try to use the binaries in the toolchain if available. if [ -n "${CI}" ]; then - echo "HELLO"! export PATH case "${OSTYPE:?}" in cygwin) From 13edcdb6392d0dbf5a921b36ac2b6def5bfb93ad Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 21 Apr 2025 06:25:24 -0500 Subject: [PATCH 07/23] cleanup --- .evergreen/scripts/install-dependencies.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.evergreen/scripts/install-dependencies.sh b/.evergreen/scripts/install-dependencies.sh index b5accea24e..675ee35df9 100755 --- a/.evergreen/scripts/install-dependencies.sh +++ b/.evergreen/scripts/install-dependencies.sh @@ -37,6 +37,7 @@ function _pip_install() { echo "Installing $2 using pip... done." } + # Ensure just is installed. if ! command -v just >/dev/null 2>&1; then # On most systems we can install directly. @@ -52,7 +53,7 @@ if ! command -v just >/dev/null 2>&1; then echo "Installing just... done." fi -# Fall back to installing uv. +# Ensure uv is installed. if ! command -v uv >/dev/null 2>&1; then echo "Installing uv..." # On most systems we can install directly. From 57c4cf7514d66ea78d6eef745e95b8328de9ebd0 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 21 Apr 2025 08:41:32 -0500 Subject: [PATCH 08/23] fix usage of uv binary --- .evergreen/run-tests.sh | 9 ++++++--- .evergreen/scripts/install-dependencies.sh | 16 ++++++++++++++++ .evergreen/scripts/run-server.sh | 5 ++++- .evergreen/scripts/setup-dev-env.sh | 22 ++++------------------ .evergreen/scripts/setup-tests.sh | 5 ++++- .evergreen/utils.sh | 19 +++++++++++++++++++ 6 files changed, 53 insertions(+), 23 deletions(-) diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh index 2b7d856d41..131e27776c 100755 --- a/.evergreen/run-tests.sh +++ b/.evergreen/run-tests.sh @@ -25,14 +25,17 @@ else exit 1 fi +. $ROOT/.evergreen/utils.sh +UV=$(get_uv) + # List the packages. -uv sync ${UV_ARGS} --reinstall -uv pip list +$UV sync ${UV_ARGS} --reinstall +$UV pip list # Ensure we go back to base environment after the test. trap "uv sync" EXIT HUP # Start the test runner. -uv run ${UV_ARGS} .evergreen/scripts/run_tests.py "$@" +$UV run ${UV_ARGS} .evergreen/scripts/run_tests.py "$@" popd diff --git a/.evergreen/scripts/install-dependencies.sh b/.evergreen/scripts/install-dependencies.sh index 675ee35df9..90d91e2438 100755 --- a/.evergreen/scripts/install-dependencies.sh +++ b/.evergreen/scripts/install-dependencies.sh @@ -38,6 +38,22 @@ function _pip_install() { } +# Try to use the binaries in the toolchain if available. +if [ -n "${CI}" ]; then + export PATH + case "${OSTYPE:?}" in + cygwin) + PATH="/cygdrive/c/Python/Current/Scripts:${PATH:-}" + ;; + darwin*) + PATH="/Library/Frameworks/Python.Framework/Versions/Current/bin:${PATH:-}" + ;; + *) + PATH="/opt/python/Current/bin:${PATH:-}" + ;; + esac +fi + # Ensure just is installed. if ! command -v just >/dev/null 2>&1; then # On most systems we can install directly. diff --git a/.evergreen/scripts/run-server.sh b/.evergreen/scripts/run-server.sh index 298eedcd3e..8c63b206c8 100755 --- a/.evergreen/scripts/run-server.sh +++ b/.evergreen/scripts/run-server.sh @@ -10,4 +10,7 @@ if [ -f $HERE/env.sh ]; then source $HERE/env.sh fi -uv run $HERE/run_server.py "$@" +. $ROOT/.evergreen/utils.sh +UV=$(get_uv) + +$UV run $HERE/run_server.py "$@" diff --git a/.evergreen/scripts/setup-dev-env.sh b/.evergreen/scripts/setup-dev-env.sh index 78e12adb41..6f3863a25d 100755 --- a/.evergreen/scripts/setup-dev-env.sh +++ b/.evergreen/scripts/setup-dev-env.sh @@ -16,22 +16,6 @@ if [ -f $HERE/test-env.sh ]; then . $HERE/test-env.sh fi -# Try to use the binaries in the toolchain if available. -if [ -n "${CI}" ]; then - export PATH - case "${OSTYPE:?}" in - cygwin) - PATH="/cygdrive/c/Python/Current:${PATH:-}" - ;; - darwin*) - PATH="/Library/Frameworks/Python.Framework/Versions/Current/bin:${PATH:-}" - ;; - *) - PATH="/opt/python/Current/bin:${PATH:-}" - ;; - esac -fi - # Ensure dependencies are installed. bash $HERE/install-dependencies.sh @@ -63,13 +47,15 @@ if [ -f $HOME/.visualStudioEnv.sh ]; then SSH_TTY=1 source $HOME/.visualStudioEnv.sh set -u fi -uv sync --frozen + +UV=$(get_uv) +$UV sync --frozen echo "Setting up python environment... done." # Ensure there is a pre-commit hook if there is a git checkout. if [ -d .git ] && [ ! -f .git/hooks/pre-commit ]; then - uv run --frozen pre-commit install + $UV run --frozen pre-commit install fi popd > /dev/null diff --git a/.evergreen/scripts/setup-tests.sh b/.evergreen/scripts/setup-tests.sh index 0b75051a68..18956d594f 100755 --- a/.evergreen/scripts/setup-tests.sh +++ b/.evergreen/scripts/setup-tests.sh @@ -20,4 +20,7 @@ if [ -f $SCRIPT_DIR/env.sh ]; then source $SCRIPT_DIR/env.sh fi -uv run $SCRIPT_DIR/setup_tests.py "$@" +. $ROOT/.evergreen/utils.sh +UV=$(get_uv) + +$UV run $SCRIPT_DIR/setup_tests.py "$@" diff --git a/.evergreen/utils.sh b/.evergreen/utils.sh index 354d18dbf7..0e72f3dbf0 100755 --- a/.evergreen/utils.sh +++ b/.evergreen/utils.sh @@ -138,3 +138,22 @@ get_python_binary() { return 1 fi } + + +# Get the appropriate uv binary. +get_uv() { + # Try to use the binaries in the toolchain if available. + if [ -f "/cygdrive/c/Python/Current/Scripts/uv.exe" ]; then + echo "/cygdrive/c/Python/Current/Scripts/uv.exe" + return + fi + if [ -f "/Library/Frameworks/Python.Framework/Versions/Current/bin/uv" ]; then + echo "/Library/Frameworks/Python.Framework/Versions/Current/bin/uv" + return + fi + if [ -f "/opt/python/Current/bin" ]; then + echo "/opt/python/Current/bin/uv" + return + fi + echo "$(which uv)" +} From 85189858869814052a0ad58e70ab4ab09346681c Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 21 Apr 2025 08:54:37 -0500 Subject: [PATCH 09/23] clean up handling of binaries --- .evergreen/just.sh | 2 +- .evergreen/run-tests.sh | 3 +-- .evergreen/scripts/configure-env.sh | 22 ++-------------------- .evergreen/scripts/install-dependencies.sh | 4 ++++ .evergreen/scripts/run-server.sh | 4 +--- .evergreen/scripts/setup-dev-env.sh | 3 ++- .evergreen/scripts/setup-system.sh | 1 - .evergreen/scripts/setup-tests.sh | 4 +--- .evergreen/utils.sh | 19 ------------------- 9 files changed, 12 insertions(+), 50 deletions(-) diff --git a/.evergreen/just.sh b/.evergreen/just.sh index bebbca8282..65c3abbe80 100755 --- a/.evergreen/just.sh +++ b/.evergreen/just.sh @@ -2,4 +2,4 @@ set -eu . .evergreen/scripts/setup-dev-env.sh -just "$@" +${JUST_BINARY:-just} "$@" diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh index 131e27776c..991c5c4788 100755 --- a/.evergreen/run-tests.sh +++ b/.evergreen/run-tests.sh @@ -25,8 +25,7 @@ else exit 1 fi -. $ROOT/.evergreen/utils.sh -UV=$(get_uv) +UV=${UV_BINARY:-uv} # List the packages. $UV sync ${UV_ARGS} --reinstall diff --git a/.evergreen/scripts/configure-env.sh b/.evergreen/scripts/configure-env.sh index 81713f4191..bb53610529 100755 --- a/.evergreen/scripts/configure-env.sh +++ b/.evergreen/scripts/configure-env.sh @@ -91,23 +91,5 @@ DRIVERS_TOOLS: "$DRIVERS_TOOLS" PROJECT_DIRECTORY: "$PROJECT_DIRECTORY" EOT -# If the toolchain is available, symlink binaries to the bin dir. This has to be done -# after drivers-tools is cloned, since we might be using its binary dir. -_bin_path="" -if [ "Windows_NT" == "${OS:-}" ]; then - _bin_path="/cygdrive/c/Python/Current/Scripts" -elif [ "$(uname -s)" != "Darwin" ]; then - _bin_path="/Library/Frameworks/Python.Framework/Versions/Current/bin" -else - _bin_path="/opt/python/Current/bin" -fi -if [ -d "${_bin_path}" ]; then - _suffix="" - if [ "Windows_NT" == "${OS:-}" ]; then - _suffix=".exe" - fi - mkdir -p $PYMONGO_BIN_DIR - ln -s ${_bin_path}/just${_suffix} $PYMONGO_BIN_DIR/just${_suffix} - ln -s ${_bin_path}/uv${_suffix} $PYMONGO_BIN_DIR/uv${_suffix} - ln -s ${_bin_path}/uvx${_suffix} $PYMONGO_BIN_DIR/uvx${_suffix} -fi +# Handle the binary dependencies. +bash $SCRIPT_DIR/install-dependencies.sh diff --git a/.evergreen/scripts/install-dependencies.sh b/.evergreen/scripts/install-dependencies.sh index 90d91e2438..dd73a3c5ac 100755 --- a/.evergreen/scripts/install-dependencies.sh +++ b/.evergreen/scripts/install-dependencies.sh @@ -82,4 +82,8 @@ if ! command -v uv >/dev/null 2>&1; then echo "Installing uv... done." fi +# Write the binary locations to the env file. +echo "UV_BINARY=$(which uv)" >> $HERE/env.sh +echo "JUST_BINARY=$(which uv)" >> $HERE/env.sh + popd > /dev/null diff --git a/.evergreen/scripts/run-server.sh b/.evergreen/scripts/run-server.sh index 8c63b206c8..d4aaa9218b 100755 --- a/.evergreen/scripts/run-server.sh +++ b/.evergreen/scripts/run-server.sh @@ -10,7 +10,5 @@ if [ -f $HERE/env.sh ]; then source $HERE/env.sh fi -. $ROOT/.evergreen/utils.sh -UV=$(get_uv) - +UV=${UV_BINARY:-uv} $UV run $HERE/run_server.py "$@" diff --git a/.evergreen/scripts/setup-dev-env.sh b/.evergreen/scripts/setup-dev-env.sh index 6f3863a25d..13392d7624 100755 --- a/.evergreen/scripts/setup-dev-env.sh +++ b/.evergreen/scripts/setup-dev-env.sh @@ -17,7 +17,8 @@ if [ -f $HERE/test-env.sh ]; then fi # Ensure dependencies are installed. -bash $HERE/install-dependencies.sh +export JUST +JUST=$($HERE/install-dependencies.sh) # Get the appropriate UV_PYTHON. . $ROOT/.evergreen/utils.sh diff --git a/.evergreen/scripts/setup-system.sh b/.evergreen/scripts/setup-system.sh index d8552e0ad2..f994cc5ed1 100755 --- a/.evergreen/scripts/setup-system.sh +++ b/.evergreen/scripts/setup-system.sh @@ -8,7 +8,6 @@ echo "Setting up system..." bash .evergreen/scripts/configure-env.sh source .evergreen/scripts/env.sh bash $DRIVERS_TOOLS/.evergreen/setup.sh -bash .evergreen/scripts/install-dependencies.sh popd # Enable core dumps if enabled on the machine diff --git a/.evergreen/scripts/setup-tests.sh b/.evergreen/scripts/setup-tests.sh index 18956d594f..c8c3742b15 100755 --- a/.evergreen/scripts/setup-tests.sh +++ b/.evergreen/scripts/setup-tests.sh @@ -20,7 +20,5 @@ if [ -f $SCRIPT_DIR/env.sh ]; then source $SCRIPT_DIR/env.sh fi -. $ROOT/.evergreen/utils.sh -UV=$(get_uv) - +UV=${UV_BINARY:-uv} $UV run $SCRIPT_DIR/setup_tests.py "$@" diff --git a/.evergreen/utils.sh b/.evergreen/utils.sh index 0e72f3dbf0..354d18dbf7 100755 --- a/.evergreen/utils.sh +++ b/.evergreen/utils.sh @@ -138,22 +138,3 @@ get_python_binary() { return 1 fi } - - -# Get the appropriate uv binary. -get_uv() { - # Try to use the binaries in the toolchain if available. - if [ -f "/cygdrive/c/Python/Current/Scripts/uv.exe" ]; then - echo "/cygdrive/c/Python/Current/Scripts/uv.exe" - return - fi - if [ -f "/Library/Frameworks/Python.Framework/Versions/Current/bin/uv" ]; then - echo "/Library/Frameworks/Python.Framework/Versions/Current/bin/uv" - return - fi - if [ -f "/opt/python/Current/bin" ]; then - echo "/opt/python/Current/bin/uv" - return - fi - echo "$(which uv)" -} From b38b00cf82938c95241a1d4558b47c00aa306fa5 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 21 Apr 2025 08:57:14 -0500 Subject: [PATCH 10/23] fix setup --- .evergreen/scripts/setup-dev-env.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.evergreen/scripts/setup-dev-env.sh b/.evergreen/scripts/setup-dev-env.sh index 13392d7624..f22ec42ca2 100755 --- a/.evergreen/scripts/setup-dev-env.sh +++ b/.evergreen/scripts/setup-dev-env.sh @@ -16,10 +16,6 @@ if [ -f $HERE/test-env.sh ]; then . $HERE/test-env.sh fi -# Ensure dependencies are installed. -export JUST -JUST=$($HERE/install-dependencies.sh) - # Get the appropriate UV_PYTHON. . $ROOT/.evergreen/utils.sh @@ -49,7 +45,7 @@ if [ -f $HOME/.visualStudioEnv.sh ]; then set -u fi -UV=$(get_uv) +UV=${UV_BINARY:-uv} $UV sync --frozen echo "Setting up python environment... done." From 320515c13b65e2b4dcefe2587da5aaa2af82344e Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 21 Apr 2025 08:59:23 -0500 Subject: [PATCH 11/23] fix setup --- .evergreen/scripts/install-dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/scripts/install-dependencies.sh b/.evergreen/scripts/install-dependencies.sh index dd73a3c5ac..9787acc006 100755 --- a/.evergreen/scripts/install-dependencies.sh +++ b/.evergreen/scripts/install-dependencies.sh @@ -84,6 +84,6 @@ fi # Write the binary locations to the env file. echo "UV_BINARY=$(which uv)" >> $HERE/env.sh -echo "JUST_BINARY=$(which uv)" >> $HERE/env.sh +echo "JUST_BINARY=$(which just)" >> $HERE/env.sh popd > /dev/null From 1231138ca37a096fae5544befd69483f933d7800 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 21 Apr 2025 09:20:28 -0500 Subject: [PATCH 12/23] fix trap --- .evergreen/run-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/run-tests.sh b/.evergreen/run-tests.sh index 991c5c4788..5361582636 100755 --- a/.evergreen/run-tests.sh +++ b/.evergreen/run-tests.sh @@ -32,7 +32,7 @@ $UV sync ${UV_ARGS} --reinstall $UV pip list # Ensure we go back to base environment after the test. -trap "uv sync" EXIT HUP +trap "${UV} sync" EXIT HUP # Start the test runner. $UV run ${UV_ARGS} .evergreen/scripts/run_tests.py "$@" From a3b66b94949d38e21c50b77ac7dad105e68187c3 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 21 Apr 2025 09:26:35 -0500 Subject: [PATCH 13/23] more cleanup --- .evergreen/scripts/configure-env.sh | 12 +----------- .evergreen/scripts/install-dependencies.sh | 11 ++++++++++- .evergreen/scripts/setup-dev-env.sh | 5 ----- 3 files changed, 11 insertions(+), 17 deletions(-) diff --git a/.evergreen/scripts/configure-env.sh b/.evergreen/scripts/configure-env.sh index bb53610529..5ec0f7347a 100755 --- a/.evergreen/scripts/configure-env.sh +++ b/.evergreen/scripts/configure-env.sh @@ -19,15 +19,7 @@ UV_CACHE_DIR=$PROJECT_DIRECTORY/.local/uv/cache DRIVERS_TOOLS_BINARIES="$DRIVERS_TOOLS/.bin" MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin" -# On Evergreen jobs, "CI" will be set, and we don't want to write to $HOME. -if [ "${CI:-}" == "true" ]; then - PYMONGO_BIN_DIR=${DRIVERS_TOOLS_BINARIES:-} -# We want to use a path that's already on PATH on spawn hosts. -else - PYMONGO_BIN_DIR=$HOME/cli_bin -fi - -PATH_EXT="$MONGODB_BINARIES:$DRIVERS_TOOLS_BINARIES:$PYMONGO_BIN_DIR:\$PATH" +PATH_EXT="$MONGODB_BINARIES:$DRIVERS_TOOLS_BINARIES:\$PATH" # Python has cygwin path problems on Windows. Detect prospective mongo-orchestration home directory if [ "Windows_NT" = "${OS:-}" ]; then # Magic variable in cygwin @@ -38,7 +30,6 @@ if [ "Windows_NT" = "${OS:-}" ]; then # Magic variable in cygwin UV_CACHE_DIR=$(cygpath -m "$UV_CACHE_DIR") DRIVERS_TOOLS_BINARIES=$(cygpath -m "$DRIVERS_TOOLS_BINARIES") MONGODB_BINARIES=$(cygpath -m "$MONGODB_BINARIES") - PYMONGO_BIN_DIR=$(cygpath -m "$PYMONGO_BIN_DIR") fi SCRIPT_DIR="$PROJECT_DIRECTORY/.evergreen/scripts" @@ -65,7 +56,6 @@ export CARGO_HOME="$CARGO_HOME" export UV_TOOL_DIR="$UV_TOOL_DIR" export UV_CACHE_DIR="$UV_CACHE_DIR" export UV_TOOL_BIN_DIR="$DRIVERS_TOOLS_BINARIES" -export PYMONGO_BIN_DIR="$PYMONGO_BIN_DIR" export PATH="$PATH_EXT" # shellcheck disable=SC2154 export PROJECT="${project:-mongo-python-driver}" diff --git a/.evergreen/scripts/install-dependencies.sh b/.evergreen/scripts/install-dependencies.sh index 9787acc006..3e7e776a0c 100755 --- a/.evergreen/scripts/install-dependencies.sh +++ b/.evergreen/scripts/install-dependencies.sh @@ -10,7 +10,16 @@ if [ -f $HERE/env.sh ]; then . $HERE/env.sh fi -_BIN_DIR=${PYMONGO_BIN_DIR:-$HOME/.local/bin} +# On Evergreen jobs, "CI" will be set, and we don't want to write to $HOME. +if [ "${CI:-}" == "true" ]; then + _BIN_DIR=${DRIVERS_TOOLS_BINARIES:-} +# We want to use a path that's already on PATH on spawn hosts. +elif [ -d "$HOME/cli_bin" ]; then + _BIN_DIR="$HOME/cli_bin" +else + _BIN_DIR="$HOME/.local/bin" +fi + export PATH="$PATH:${_BIN_DIR}" # Helper function to pip install a dependency using a temporary python env. diff --git a/.evergreen/scripts/setup-dev-env.sh b/.evergreen/scripts/setup-dev-env.sh index f22ec42ca2..f3ad02a635 100755 --- a/.evergreen/scripts/setup-dev-env.sh +++ b/.evergreen/scripts/setup-dev-env.sh @@ -29,11 +29,6 @@ fi export UV_PYTHON=${PYTHON_BINARY} echo "Using python $UV_PYTHON" -# Add the default install path to the path if needed. -if [ -z "${PYMONGO_BIN_DIR:-}" ]; then - export PATH="$PATH:$HOME/.local/bin" -fi - # Set up venv, making sure c extensions build unless disabled. if [ -z "${NO_EXT:-}" ]; then export PYMONGO_C_EXT_MUST_BUILD=1 From 8422db43f6f79c49dbd69cb4baa9ab0f4fcfef46 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 21 Apr 2025 09:33:27 -0500 Subject: [PATCH 14/23] fix teardown --- .evergreen/scripts/teardown-tests.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.evergreen/scripts/teardown-tests.sh b/.evergreen/scripts/teardown-tests.sh index 898425b6cf..381165e38a 100755 --- a/.evergreen/scripts/teardown-tests.sh +++ b/.evergreen/scripts/teardown-tests.sh @@ -21,4 +21,5 @@ else fi # Teardown the test runner. -uv run $SCRIPT_DIR/teardown_tests.py +UV=${UV_BINARY:-uv} +$UV run $SCRIPT_DIR/teardown_tests.py From 6f2c90806df0db6559848fe775fb9ab31cd23fd1 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 21 Apr 2025 09:47:35 -0500 Subject: [PATCH 15/23] debug --- .evergreen/scripts/run-server.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.evergreen/scripts/run-server.sh b/.evergreen/scripts/run-server.sh index d4aaa9218b..f23d644c13 100755 --- a/.evergreen/scripts/run-server.sh +++ b/.evergreen/scripts/run-server.sh @@ -11,4 +11,6 @@ if [ -f $HERE/env.sh ]; then fi UV=${UV_BINARY:-uv} +env +exit 1 $UV run $HERE/run_server.py "$@" From 653ba6cb811f33528016c98024e8642c5d29af7c Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 21 Apr 2025 10:16:04 -0500 Subject: [PATCH 16/23] remove use of path_ext --- .evergreen/scripts/configure-env.sh | 3 --- .evergreen/scripts/run-server.sh | 2 -- 2 files changed, 5 deletions(-) diff --git a/.evergreen/scripts/configure-env.sh b/.evergreen/scripts/configure-env.sh index 5ec0f7347a..7d2777288b 100755 --- a/.evergreen/scripts/configure-env.sh +++ b/.evergreen/scripts/configure-env.sh @@ -19,8 +19,6 @@ UV_CACHE_DIR=$PROJECT_DIRECTORY/.local/uv/cache DRIVERS_TOOLS_BINARIES="$DRIVERS_TOOLS/.bin" MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin" -PATH_EXT="$MONGODB_BINARIES:$DRIVERS_TOOLS_BINARIES:\$PATH" - # Python has cygwin path problems on Windows. Detect prospective mongo-orchestration home directory if [ "Windows_NT" = "${OS:-}" ]; then # Magic variable in cygwin DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS) @@ -56,7 +54,6 @@ export CARGO_HOME="$CARGO_HOME" export UV_TOOL_DIR="$UV_TOOL_DIR" export UV_CACHE_DIR="$UV_CACHE_DIR" export UV_TOOL_BIN_DIR="$DRIVERS_TOOLS_BINARIES" -export PATH="$PATH_EXT" # shellcheck disable=SC2154 export PROJECT="${project:-mongo-python-driver}" export PIP_QUIET=1 diff --git a/.evergreen/scripts/run-server.sh b/.evergreen/scripts/run-server.sh index f23d644c13..d4aaa9218b 100755 --- a/.evergreen/scripts/run-server.sh +++ b/.evergreen/scripts/run-server.sh @@ -11,6 +11,4 @@ if [ -f $HERE/env.sh ]; then fi UV=${UV_BINARY:-uv} -env -exit 1 $UV run $HERE/run_server.py "$@" From a612db798f8b7eba4a16f7b56b82a232f2257138 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 21 Apr 2025 10:24:02 -0500 Subject: [PATCH 17/23] debug --- .evergreen/scripts/run-server.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.evergreen/scripts/run-server.sh b/.evergreen/scripts/run-server.sh index d4aaa9218b..ed4ae77abc 100755 --- a/.evergreen/scripts/run-server.sh +++ b/.evergreen/scripts/run-server.sh @@ -10,5 +10,11 @@ if [ -f $HERE/env.sh ]; then source $HERE/env.sh fi + +${DRIVERS_TOOLS}/.evergreen/mongodl --out mongodb-bin --strip-path-components 2 +set -x +./mongodb-bin/mongod --version +exit 1 + UV=${UV_BINARY:-uv} $UV run $HERE/run_server.py "$@" From 86e6c6efd1d53fb734877b72ed32e5856af0ed61 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 21 Apr 2025 10:34:33 -0500 Subject: [PATCH 18/23] debug --- .evergreen/scripts/run-server.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.evergreen/scripts/run-server.sh b/.evergreen/scripts/run-server.sh index ed4ae77abc..6e2d14970e 100755 --- a/.evergreen/scripts/run-server.sh +++ b/.evergreen/scripts/run-server.sh @@ -10,9 +10,12 @@ if [ -f $HERE/env.sh ]; then source $HERE/env.sh fi - -${DRIVERS_TOOLS}/.evergreen/mongodl --out mongodb-bin --strip-path-components 2 set -x +/Library/Frameworks/Python.Framework/Versions/3.9/bin/python3 -c "import platform;print(platform.machine())" +/Library/Frameworks/Python.Framework/Versions/3.9/bin/python3 -c "import platform;print(platform.processor())" +exit 1 +${DRIVERS_TOOLS}/.evergreen/mongodl --out mongodb-bin --strip-path-components 2 + ./mongodb-bin/mongod --version exit 1 From 0459dde5cbe17cec68346d1621ffbd111e598ef3 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 21 Apr 2025 11:42:53 -0500 Subject: [PATCH 19/23] debug --- .evergreen/scripts/run-server.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.evergreen/scripts/run-server.sh b/.evergreen/scripts/run-server.sh index 6e2d14970e..31024c1480 100755 --- a/.evergreen/scripts/run-server.sh +++ b/.evergreen/scripts/run-server.sh @@ -11,6 +11,8 @@ if [ -f $HERE/env.sh ]; then fi set -x +/Library/Frameworks/Python.Framework +/Library/Frameworks/Python.Framework/Versions /Library/Frameworks/Python.Framework/Versions/3.9/bin/python3 -c "import platform;print(platform.machine())" /Library/Frameworks/Python.Framework/Versions/3.9/bin/python3 -c "import platform;print(platform.processor())" exit 1 From c6f15edaef299ac7fddce0c8f4eeec7006218c2d Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 21 Apr 2025 11:51:55 -0500 Subject: [PATCH 20/23] debug --- .evergreen/scripts/run-server.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.evergreen/scripts/run-server.sh b/.evergreen/scripts/run-server.sh index 31024c1480..c505d1dc24 100755 --- a/.evergreen/scripts/run-server.sh +++ b/.evergreen/scripts/run-server.sh @@ -11,8 +11,8 @@ if [ -f $HERE/env.sh ]; then fi set -x -/Library/Frameworks/Python.Framework -/Library/Frameworks/Python.Framework/Versions +ls /Library/Frameworks/Python.Framework +ls /Library/Frameworks/Python.Framework/Versions /Library/Frameworks/Python.Framework/Versions/3.9/bin/python3 -c "import platform;print(platform.machine())" /Library/Frameworks/Python.Framework/Versions/3.9/bin/python3 -c "import platform;print(platform.processor())" exit 1 From 5c575b4c2402bf6c5f3c998c29ff5432fada850a Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 21 Apr 2025 12:23:39 -0500 Subject: [PATCH 21/23] test with fix-arch-handling --- .evergreen/scripts/configure-env.sh | 4 ++-- .evergreen/scripts/run-server.sh | 11 ----------- 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/.evergreen/scripts/configure-env.sh b/.evergreen/scripts/configure-env.sh index 7d2777288b..22893db4e0 100755 --- a/.evergreen/scripts/configure-env.sh +++ b/.evergreen/scripts/configure-env.sh @@ -61,8 +61,8 @@ EOT # Write the .env file for drivers-tools. rm -rf $DRIVERS_TOOLS -BRANCH=master -ORG=mongodb-labs +BRANCH=fix-arch-handling +ORG=blink1073 git clone --branch $BRANCH https://github.com/$ORG/drivers-evergreen-tools.git $DRIVERS_TOOLS cat < ${DRIVERS_TOOLS}/.env diff --git a/.evergreen/scripts/run-server.sh b/.evergreen/scripts/run-server.sh index c505d1dc24..d4aaa9218b 100755 --- a/.evergreen/scripts/run-server.sh +++ b/.evergreen/scripts/run-server.sh @@ -10,16 +10,5 @@ if [ -f $HERE/env.sh ]; then source $HERE/env.sh fi -set -x -ls /Library/Frameworks/Python.Framework -ls /Library/Frameworks/Python.Framework/Versions -/Library/Frameworks/Python.Framework/Versions/3.9/bin/python3 -c "import platform;print(platform.machine())" -/Library/Frameworks/Python.Framework/Versions/3.9/bin/python3 -c "import platform;print(platform.processor())" -exit 1 -${DRIVERS_TOOLS}/.evergreen/mongodl --out mongodb-bin --strip-path-components 2 - -./mongodb-bin/mongod --version -exit 1 - UV=${UV_BINARY:-uv} $UV run $HERE/run_server.py "$@" From 548d794e00a33d2aca419888c4a7184bc8911a38 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 21 Apr 2025 12:27:00 -0500 Subject: [PATCH 22/23] cleanup --- .evergreen/config.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 46c86103ad..3abd4a83cc 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -18,6 +18,12 @@ command_type: system exec_timeout_secs: 3600 # 60 minutes is the longest we'll ever run (primarily # for macos hosts) +# Ensure that setup and teardown is working as expected. +pre_error_fails_task: true +pre_timeout_secs: 1800 # 5 minutes +post_error_fails_task: true +post_timeout_secs: 1800 # 5 minutes + # What to do when evergreen hits the timeout (`post:` tasks are run automatically) timeout: - command: subprocess.exec @@ -35,8 +41,6 @@ pre: - func: "assume ec2 role" post: - # Disabled, causing timeouts - # - func: "upload working dir" - func: "teardown system" - func: "upload coverage" - func: "upload mo artifacts" From 5bddc024aad53f378729280a99784cf7cd731fe9 Mon Sep 17 00:00:00 2001 From: Steven Silvester Date: Mon, 21 Apr 2025 12:31:01 -0500 Subject: [PATCH 23/23] debug --- .evergreen/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.evergreen/config.yml b/.evergreen/config.yml index 3abd4a83cc..c1af32e2b2 100644 --- a/.evergreen/config.yml +++ b/.evergreen/config.yml @@ -1,5 +1,5 @@ ######################################## -# Evergreen Template for MongoDB Drivers +# Evergreen Configuration for PyMongo ######################################## # When a task that used to pass starts to fail