@@ -4,60 +4,50 @@ set -eu
4
4
# Set where binaries are expected to be.
5
5
# On Evergreen jobs, "CI" will be set, and we don't want to write to $HOME.
6
6
if [ " ${CI:- } " == " true" ]; then
7
- BIN_DIR=$DRIVERS_TOOLS_BINARIES
7
+ _BIN_DIR=$DRIVERS_TOOLS_BINARIES
8
+ # On Windows spawn hosts, $HOME/cli_bin is on the PATH.
9
+ elif [ " Windows_NT" = " ${OS:- } " ]; then
10
+ _BIN_DIR=$HOME /cli_bin
11
+ # On local machines and Linux spawn hosts, we expect $HOME/.local/bin to be on the PATH.
8
12
else
9
- BIN_DIR =$HOME /.local/bin
13
+ _BIN_DIR =$HOME /.local/bin
10
14
fi
15
+ mkdir -p $_BIN_DIR 2> /dev/null || true
11
16
17
+ function _pip_install() {
18
+ _HERE=$( dirname ${BASH_SOURCE:- $0 } )
19
+ . $_HERE /utils.sh
20
+ _VENV_PATH=$( mktemp -d)
21
+ createvirtualenv $( find_python3) $_VENV_PATH
22
+ python -m pip install $1
23
+ ln -s $( which $2 ) $_BIN_DIR /$2
24
+ }
12
25
13
26
_CURL_ARGS=" --tlsv1.2 -LsSf"
14
27
15
- function _cargo_install() {
16
- # CARGO_HOME is defined in configure-env.sh
17
- export CARGO_HOME=${CARGO_HOME:- $HOME / .cargo/ }
18
- export RUSTUP_HOME=" ${CARGO_HOME} /.rustup"
19
- . ${DRIVERS_TOOLS} /.evergreen/install-rust.sh
20
- cargo install --force --quiet " $@ "
21
- }
22
-
23
28
# Install just.
24
29
if ! command -v just 2> /dev/null; then
25
30
if [ " Windows_NT" = " ${OS:- } " ]; then
26
- TARGET =" --target x86_64-pc-windows-msvc"
31
+ _TARGET =" --target x86_64-pc-windows-msvc"
27
32
else
28
- TARGET =" "
33
+ _TARGET =" "
29
34
fi
30
- curl $_CURL_ARGS https://just.systems/install.sh | bash -s -- $TARGET --to " $BIN_DIR " || {
31
- _cargo_install just
32
- if [ " Windows_NT" = " ${OS:- } " ]; then
33
- mv $CARGO_HOME /bin/just.exe $BIN_DIR /just
34
- else
35
- mv $CARGO_HOME /bin/just $BIN_DIR
36
- fi
35
+ # On most systems we can install directly.
36
+ curl $_CURL_ARGS https://just.systems/install.sh | bash -s -- $_TARGET --to " $_BIN_DIR " || {
37
+ _pip_install rust-just just
37
38
}
38
39
if ! command -v just 2> /dev/null; then
39
- export PATH=" $PATH :$BIN_DIR "
40
+ export PATH=" $PATH :$_BIN_DIR "
40
41
fi
41
42
fi
42
43
43
44
# Install uv.
44
45
if ! command -v uv 2> /dev/null; then
45
- # On most non-Windows systems we can install directly.
46
- if [ " Windows_NT" != " ${OS:- } " ]; then
47
- curl $_CURL_ARGS https://astral.sh/uv/install.sh | env UV_INSTALL_DIR=" $BIN_DIR " INSTALLER_NO_MODIFY_PATH=1 sh || true
48
- fi
49
- # On Windows or unsupported systems, fall back to installing from cargo.
50
- if [ ! -f $BIN_DIR /uv ]; then
51
- _cargo_install --git https://github.com/astral-sh/uv uv
52
- if [ " Windows_NT" = " ${OS:- } " ]; then
53
- mv $CARGO_HOME /bin/uv.exe $BIN_DIR /uv
54
- mv $CARGO_HOME /bin/uvx.exe $BIN_DIR /uvx
55
- else
56
- mv $CARGO_HOME /bin/uv $BIN_DIR
57
- mv $CARGO_HOME /bin/uvx $BIN_DIR
58
- fi
59
- fi
46
+ # On most systems we can install directly.
47
+ curl $_CURL_ARGS https://astral.sh/uv/install.sh | env UV_INSTALL_DIR=" $_BIN_DIR " INSTALLER_NO_MODIFY_PATH=1 sh || {
48
+ _pip_install uv uv
49
+ }
60
50
if ! command -v uv 2> /dev/null; then
61
- export PATH=" $PATH :$BIN_DIR "
51
+ export PATH=" $PATH :$_BIN_DIR "
62
52
fi
63
53
fi
0 commit comments