Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 29 additions & 20 deletions .evergreen/install-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,32 +99,41 @@ uv venv venv &>/dev/null
popd >/dev/null # $SCRIPT_DIR
pushd "$TARGET_DIR" >/dev/null

# uv requires UV_TOOL_BIN_DIR is `C:\a\b\c` instead of `/cygdrive/c/a/b/c` on Windows.
if [[ "${OSTYPE:?}" == cygwin ]]; then
UV_TOOL_BIN_DIR="$(cygpath -aw .)"
else
UV_TOOL_BIN_DIR="$(pwd)"
fi
export UV_TOOL_BIN_DIR

# Pin the uv binary version used by subsequent commands.
uv tool install -q --force "uv~=0.8.0"
PATH="${UV_TOOL_BIN_DIR:?}:${PATH:-}"
command -V uv
uv --version

# Workaround for https://github.com/astral-sh/uv/issues/5815.
printf "" >|uv-requirements.txt
uv run --quiet --frozen --isolated uv pip freeze >>uv-requirements.txt

# Support overriding lockfile dependencies.
if [[ ! -f "${DRIVERS_TOOLS_INSTALL_CLI_OVERRIDES:-}" ]]; then
printf "" >|"${DRIVERS_TOOLS_INSTALL_CLI_OVERRIDES:="uv-override-dependencies.txt"}"
fi

declare uv_install_args
uv_install_args=(
--quiet
--force
--editable
--with certifi
--with-requirements uv-requirements.txt
--overrides "${DRIVERS_TOOLS_INSTALL_CLI_OVERRIDES:?}"
)
uv tool install "${uv_install_args[@]:?}" .

# 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 "${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 "${uv_install_args[@]:?}" .
fi
# Support running tool executables on Windows without including the ".exe" suffix.
find . -maxdepth 1 -type f -name '*.exe' -exec \
bash -c "ln -sf \"\$0\" \"\$(echo \"\$0\" | sed -E -e 's|(.*)\.exe|\1|')\"" {} \;

popd >/dev/null # "$TARGET_DIR"
2 changes: 1 addition & 1 deletion .evergreen/orchestration/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "drivers-orchestration"
version = "0.1.0"
description = 'Scripts for drivers orchestration'
requires-python = ">=3.8"
requires-python = ">=3.9"
license = "MIT"
keywords = []
authors = [
Expand Down
18 changes: 14 additions & 4 deletions .evergreen/orchestration/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,20 @@

set -o errexit

SCRIPT_DIR=$(dirname ${BASH_SOURCE[0]})
. $SCRIPT_DIR/../handle-paths.sh
SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
. "${SCRIPT_DIR:?}/../handle-paths.sh"

export DRIVERS_TOOLS_INSTALL_CLI_OVERRIDES
DRIVERS_TOOLS_INSTALL_CLI_OVERRIDES="${SCRIPT_DIR:?}/uv-override-dependencies.txt"
printf "" >|"${DRIVERS_TOOLS_INSTALL_CLI_OVERRIDES:?}"

# Preserve pymongo compatibility with the requested server version.
case "${MONGODB_VERSION:-"latest"}" in
3.6) echo "pymongo<4.11" >>"${DRIVERS_TOOLS_INSTALL_CLI_OVERRIDES:?}" ;;
4.0) echo "pymongo<4.14" >>"${DRIVERS_TOOLS_INSTALL_CLI_OVERRIDES:?}" ;;
esac

# Install CLIs into this directory (default path for $PROJECT_ORCHESTRATION_HOME
# and $MONGO_ORCHESTRATION_HOME) and the parent directory ($DRIVERS_TOOLS).
bash $SCRIPT_DIR/../install-cli.sh $SCRIPT_DIR/..
bash $SCRIPT_DIR/../install-cli.sh $SCRIPT_DIR
bash "${SCRIPT_DIR:?}/../install-cli.sh" "${SCRIPT_DIR:?}/.."
bash "${SCRIPT_DIR:?}/../install-cli.sh" "${SCRIPT_DIR:?}"
Loading
Loading