Skip to content

Commit 48e1797

Browse files
committed
clean up path handling
1 parent feb4b45 commit 48e1797

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

.evergreen/scripts/configure-env.sh

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,15 @@ UV_TOOL_DIR=$PROJECT_DIRECTORY/.local/uv/tools
1818
UV_CACHE_DIR=$PROJECT_DIRECTORY/.local/uv/cache
1919
DRIVERS_TOOLS_BINARIES="$DRIVERS_TOOLS/.bin"
2020
MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin"
21-
PATH="$MONGODB_BINARIES:$DRIVERS_TOOLS_BINARIES:$PATH"
21+
22+
# On Evergreen jobs, "CI" will be set, and we don't want to write to $HOME.
23+
if [ "${CI:-}" == "true" ]; then
24+
PYMONGO_BIN_DIR=${DRIVERS_TOOLS_BINARIES:-}
25+
elif [ "Windows_NT" = "${OS:-}" ]; then
26+
PYMONGO_BIN_DIR=$HOME/cli_bin
27+
else
28+
PYMONGO_BIN_DIR=""
29+
fi
2230

2331
# Python has cygwin path problems on Windows. Detect prospective mongo-orchestration home directory
2432
if [ "Windows_NT" = "${OS:-}" ]; then # Magic variable in cygwin
@@ -27,6 +35,7 @@ if [ "Windows_NT" = "${OS:-}" ]; then # Magic variable in cygwin
2735
CARGO_HOME=$(cygpath -m $CARGO_HOME)
2836
UV_TOOL_DIR=$(cygpath -m "$UV_TOOL_DIR")
2937
UV_CACHE_DIR=$(cygpath -m "$UV_CACHE_DIR")
38+
PYMONGO_BIN_DIR=$(cygpath -m $PYMONGO_BIN_DIR)
3039
fi
3140

3241
SCRIPT_DIR="$PROJECT_DIRECTORY/.evergreen/scripts"
@@ -38,6 +47,7 @@ if [ -f "$SCRIPT_DIR/env.sh" ]; then
3847
fi
3948

4049
MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration"
50+
PATH="$MONGODB_BINARIES:$DRIVERS_TOOLS_BINARIES:$PYMONGO_BIN_DIR:$PATH"
4151

4252
cat <<EOT > "$SCRIPT_DIR"/env.sh
4353
export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"

.evergreen/scripts/install-dependencies.sh

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,7 @@
22

33
set -eu
44

5-
# On Evergreen jobs, "CI" will be set, and we don't want to write to $HOME.
6-
if [ "${CI:-}" == "true" ]; then
7-
echo "REALLY? $DRIVERS_TOOLS_BINARIES"
8-
_BIN_DIR=${DRIVERS_TOOLS_BINARIES:-}
9-
elif [ "Windows_NT" = "${OS:-}" ]; then
10-
_BIN_DIR=$HOME/cli_bin
11-
else
12-
_BIN_DIR=$HOME/.local/bin
13-
fi
14-
export PATH="$PATH:$_BIN_DIR"
15-
5+
_BIN_DIR=${PYMONGO_BIN_DIR:-}
166

177
# Helper function to pip install a dependency using a temporary python env.
188
function _pip_install() {
@@ -29,6 +19,10 @@ function _pip_install() {
2919

3020
# Ensure just is installed.
3121
if ! command -v just 2>/dev/null; then
22+
if [ -z "${_BIN_DIR}" ]; then
23+
echo "Please install just!"
24+
exit 1
25+
fi
3226
# On most systems we can install directly.
3327
_TARGET=""
3428
if [ "Windows_NT" = "${OS:-}" ]; then
@@ -44,6 +38,10 @@ fi
4438

4539
# Install uv.
4640
if ! command -v uv 2>/dev/null; then
41+
if [ -z "${_BIN_DIR}" ]; then
42+
echo "Please install uv!"
43+
exit 1
44+
fi
4745
echo "Installing uv..."
4846
# On most systems we can install directly.
4947
curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR="$_BIN_DIR" INSTALLER_NO_MODIFY_PATH=1 sh || {

.evergreen/scripts/setup-dev-env.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ fi
1717
# Ensure dependencies are installed.
1818
. $HERE/install-dependencies.sh
1919

20-
2120
# Set the location of the python bin dir.
2221
if [ "Windows_NT" = "${OS:-}" ]; then
2322
BIN_DIR=.venv/Scripts

0 commit comments

Comments
 (0)