Skip to content

Commit c311dea

Browse files
committed
PYTHON-5203 Use uv from Python toolchain if available
1 parent 4322fdf commit c311dea

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

.evergreen/scripts/configure-env.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,25 @@ fi
2929

3030
PATH_EXT="$MONGODB_BINARIES:$DRIVERS_TOOLS_BINARIES:$PYMONGO_BIN_DIR:\$PATH"
3131

32+
# If the toolchain is available, symlink binaries to the bin dir.
33+
_bin_path=""
34+
if [ "Windows_NT" == "${OS:-}" ]; then
35+
_bin_path="/cygdrive/c/Python/Current/Scripts"
36+
elif [ "$(uname -s)" != "Darwin" ]; then
37+
_bin_path="/Library/Frameworks/Python.Framework/Versions/Current/bin"
38+
else
39+
_bin_path="/opt/python/Current/bin"
40+
fi
41+
if [ -d "${_bin_path}" ]; then
42+
_suffix=""
43+
if [ "Windows_NT" == "${OS:-}" ]; then
44+
_suffix=".exe"
45+
fi
46+
ln -s ${_bin_path}/just${_suffix} $PYMONGO_BIN_DIR/just
47+
ln -s ${_bin_path}/uv${_suffix} $PYMONGO_BIN_DIR/uv
48+
ln -s ${_bin_path}/uvx${_suffix} $PYMONGO_BIN_DIR/uvx
49+
fi
50+
3251
# Python has cygwin path problems on Windows. Detect prospective mongo-orchestration home directory
3352
if [ "Windows_NT" = "${OS:-}" ]; then # Magic variable in cygwin
3453
DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS)

.evergreen/scripts/install-dependencies.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,14 @@ function _pip_install() {
2424
echo "Installing $2 using pip..."
2525
createvirtualenv "$(find_python3)" $_VENV_PATH
2626
python -m pip install $1
27+
_suffix=""
2728
if [ "Windows_NT" = "${OS:-}" ]; then
28-
ln -s "$(which $2)" $_BIN_DIR/$2.exe
29-
else
30-
ln -s "$(which $2)" $_BIN_DIR/$2
29+
_suffix=".exe"
30+
fi
31+
ln -s "$(which $2)" $_BIN_DIR/${2}${_suffix}
32+
# uv also comes with a uvx binary.
33+
if [ $2 == "uv" ]; then
34+
ln -s "$(which uvx)" $_BIN_DIR/uvx${_suffix}
3135
fi
3236
echo "Installed to ${_BIN_DIR}"
3337
echo "Installing $2 using pip... done."

0 commit comments

Comments
 (0)