Skip to content

Commit d28ea9c

Browse files
committed
set default
1 parent 025d793 commit d28ea9c

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

.evergreen/scripts/setup-uv-python.sh

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ set -eu
55
HERE=$(dirname ${BASH_SOURCE:-$0})
66
HERE="$( cd -- "$HERE" > /dev/null 2>&1 && pwd )"
77

8+
# Use min supported version by default.
9+
_python="3.10"
10+
811
# Source the env files to pick up common variables.
912
if [ -f $HERE/env.sh ]; then
1013
. $HERE/env.sh
@@ -18,7 +21,8 @@ fi
1821
# Translate PYTHON_BINARY/PYTHON_VERSION to UV_PYTHON.
1922
if [ -z "${UV_PYTHON:-}" ]; then
2023
if [ -n "${PYTHON_BINARY:-}" ]; then
21-
echo "export UV_PYTHON=$PYTHON_BINARY" >> $HERE/env.sh
24+
_python=$PYTHON_BINARY
25+
2226
elif [ -n "${PYTHON_VERSION:-}" ]; then
2327
version=$PYTHON_VERSION
2428
if [ "$(uname -s)" = "Darwin" ]; then
@@ -30,19 +34,19 @@ if [ -z "${UV_PYTHON:-}" ]; then
3034
framework_dir="Python"
3135
fi
3236
version=$(echo "$version" | sed 's/t//g')
33-
UV_PYTHON="/Library/Frameworks/$framework_dir.Framework/Versions/$version/bin/$binary_name"
37+
_python="/Library/Frameworks/$framework_dir.Framework/Versions/$version/bin/$binary_name"
3438
elif [ "Windows_NT" = "${OS:-}" ]; then
3539
version=$(echo $version | cut -d. -f1,2 | sed 's/\.//g; s/t//g')
3640
if [ -n "${IS_WIN32:-}" ]; then
37-
UV_PYTHON="C:/python/32/Python$version/python.exe"
41+
_python="C:/python/32/Python$version/python.exe"
3842
else
39-
UV_PYTHON="C:/python/Python$version/python.exe"
43+
_python="C:/python/Python$version/python.exe"
4044
fi
4145
elif [ -d "/opt/python/$version/bin" ]; then
42-
UV_PYTHON="/opt/python/$version/bin/python3"
46+
_python="/opt/python/$version/bin/python3"
4347
else
44-
UV_PYTHON="${PYTHON_VERSION}"
48+
_python="${PYTHON_VERSION}"
4549
fi
46-
echo "export UV_PYTHON=$UV_PYTHON" >> $HERE/env.sh
4750
fi
51+
echo "export UV_PYTHON=$_python" >> $HERE/env.sh
4852
fi

0 commit comments

Comments
 (0)