Skip to content

Commit 57c4cf7

Browse files
committed
fix usage of uv binary
1 parent 13edcdb commit 57c4cf7

File tree

6 files changed

+53
-23
lines changed

6 files changed

+53
-23
lines changed

.evergreen/run-tests.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,17 @@ else
2525
exit 1
2626
fi
2727

28+
. $ROOT/.evergreen/utils.sh
29+
UV=$(get_uv)
30+
2831
# List the packages.
29-
uv sync ${UV_ARGS} --reinstall
30-
uv pip list
32+
$UV sync ${UV_ARGS} --reinstall
33+
$UV pip list
3134

3235
# Ensure we go back to base environment after the test.
3336
trap "uv sync" EXIT HUP
3437

3538
# Start the test runner.
36-
uv run ${UV_ARGS} .evergreen/scripts/run_tests.py "$@"
39+
$UV run ${UV_ARGS} .evergreen/scripts/run_tests.py "$@"
3740

3841
popd

.evergreen/scripts/install-dependencies.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,22 @@ function _pip_install() {
3838
}
3939

4040

41+
# Try to use the binaries in the toolchain if available.
42+
if [ -n "${CI}" ]; then
43+
export PATH
44+
case "${OSTYPE:?}" in
45+
cygwin)
46+
PATH="/cygdrive/c/Python/Current/Scripts:${PATH:-}"
47+
;;
48+
darwin*)
49+
PATH="/Library/Frameworks/Python.Framework/Versions/Current/bin:${PATH:-}"
50+
;;
51+
*)
52+
PATH="/opt/python/Current/bin:${PATH:-}"
53+
;;
54+
esac
55+
fi
56+
4157
# Ensure just is installed.
4258
if ! command -v just >/dev/null 2>&1; then
4359
# On most systems we can install directly.

.evergreen/scripts/run-server.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@ if [ -f $HERE/env.sh ]; then
1010
source $HERE/env.sh
1111
fi
1212

13-
uv run $HERE/run_server.py "$@"
13+
. $ROOT/.evergreen/utils.sh
14+
UV=$(get_uv)
15+
16+
$UV run $HERE/run_server.py "$@"

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

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,6 @@ if [ -f $HERE/test-env.sh ]; then
1616
. $HERE/test-env.sh
1717
fi
1818

19-
# Try to use the binaries in the toolchain if available.
20-
if [ -n "${CI}" ]; then
21-
export PATH
22-
case "${OSTYPE:?}" in
23-
cygwin)
24-
PATH="/cygdrive/c/Python/Current:${PATH:-}"
25-
;;
26-
darwin*)
27-
PATH="/Library/Frameworks/Python.Framework/Versions/Current/bin:${PATH:-}"
28-
;;
29-
*)
30-
PATH="/opt/python/Current/bin:${PATH:-}"
31-
;;
32-
esac
33-
fi
34-
3519
# Ensure dependencies are installed.
3620
bash $HERE/install-dependencies.sh
3721

@@ -63,13 +47,15 @@ if [ -f $HOME/.visualStudioEnv.sh ]; then
6347
SSH_TTY=1 source $HOME/.visualStudioEnv.sh
6448
set -u
6549
fi
66-
uv sync --frozen
50+
51+
UV=$(get_uv)
52+
$UV sync --frozen
6753

6854
echo "Setting up python environment... done."
6955

7056
# Ensure there is a pre-commit hook if there is a git checkout.
7157
if [ -d .git ] && [ ! -f .git/hooks/pre-commit ]; then
72-
uv run --frozen pre-commit install
58+
$UV run --frozen pre-commit install
7359
fi
7460

7561
popd > /dev/null

.evergreen/scripts/setup-tests.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,7 @@ if [ -f $SCRIPT_DIR/env.sh ]; then
2020
source $SCRIPT_DIR/env.sh
2121
fi
2222

23-
uv run $SCRIPT_DIR/setup_tests.py "$@"
23+
. $ROOT/.evergreen/utils.sh
24+
UV=$(get_uv)
25+
26+
$UV run $SCRIPT_DIR/setup_tests.py "$@"

.evergreen/utils.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,22 @@ get_python_binary() {
138138
return 1
139139
fi
140140
}
141+
142+
143+
# Get the appropriate uv binary.
144+
get_uv() {
145+
# Try to use the binaries in the toolchain if available.
146+
if [ -f "/cygdrive/c/Python/Current/Scripts/uv.exe" ]; then
147+
echo "/cygdrive/c/Python/Current/Scripts/uv.exe"
148+
return
149+
fi
150+
if [ -f "/Library/Frameworks/Python.Framework/Versions/Current/bin/uv" ]; then
151+
echo "/Library/Frameworks/Python.Framework/Versions/Current/bin/uv"
152+
return
153+
fi
154+
if [ -f "/opt/python/Current/bin" ]; then
155+
echo "/opt/python/Current/bin/uv"
156+
return
157+
fi
158+
echo "$(which uv)"
159+
}

0 commit comments

Comments
 (0)