@@ -7,44 +7,48 @@ if [ "${CI:-}" == "true" ]; then
7
7
BIN_DIR=$DRIVERS_TOOLS_BINARIES
8
8
else
9
9
BIN_DIR=$HOME /.local/bin
10
- # Ensure bin dir is on the path.
11
- export PATH=" $BIN_DIR :$PATH "
12
10
fi
13
11
12
+
13
+ _CURL_ARGS=" --proto '=https' --tlsv1.2 -LsSf"
14
+
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 " $@ "
21
+ }
22
+
14
23
# Install just.
15
- if [ ! -f $BIN_DIR / just ] ; then
24
+ if ! command -v just 2> /dev/null ; then
16
25
if [ " Windows_NT" = " ${OS:- } " ]; then
17
26
TARGET=" --target x86_64-pc-windows-msvc"
18
27
else
19
28
TARGET=" "
20
29
fi
21
- curl --proto ' =https' --tlsv1.2 -sSf https://just.systems/install.sh | bash -s -- $TARGET --to " $BIN_DIR " || {
22
- # CARGO_HOME is defined in configure-env.sh
23
- export CARGO_HOME=${CARGO_HOME:- $HOME / .cargo/ }
24
- export RUSTUP_HOME=" ${CARGO_HOME} /.rustup"
25
- . ${DRIVERS_TOOLS} /.evergreen/install-rust.sh
26
- cargo install just
30
+ curl $_CURL_ARGS https://just.systems/install.sh | bash -s -- $TARGET --to " $BIN_DIR " || {
31
+ _cargo_install just
27
32
if [ " Windows_NT" = " ${OS:- } " ]; then
28
33
mv $CARGO_HOME /bin/just.exe $BIN_DIR /just
29
34
else
30
- mv $CARGO_HOME /binjust $BIN_DIR
35
+ mv $CARGO_HOME /bin/just $BIN_DIR
31
36
fi
32
37
}
38
+ if ! command -v just 2> /dev/null; then
39
+ export PATH=" $PATH :$BIN_DIR "
40
+ fi
33
41
fi
34
42
35
43
# Install uv.
36
- if [ ! -f $BIN_DIR / uv ] ; then
44
+ if ! command -v uv 2> /dev/null ; then
37
45
# On most non-Windows systems we can install directly.
38
46
if [ " Windows_NT" != " ${OS:- } " ]; then
39
- curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR=" $BIN_DIR " INSTALLER_NO_MODIFY_PATH=1 sh || true
47
+ curl $_CURL_ARGS https://astral.sh/uv/install.sh | env UV_INSTALL_DIR=" $BIN_DIR " INSTALLER_NO_MODIFY_PATH=1 sh || true
40
48
fi
41
49
# On Windows or unsupported systems, fall back to installing from cargo.
42
50
if [ ! -f $BIN_DIR /uv ]; then
43
- # CARGO_HOME is defined in configure-env.sh
44
- export CARGO_HOME=${CARGO_HOME:- $HOME / .cargo/ }
45
- export RUSTUP_HOME=" ${CARGO_HOME} /.rustup"
46
- . ${DRIVERS_TOOLS} /.evergreen/install-rust.sh
47
- cargo install --git https://github.com/astral-sh/uv uv
51
+ _cargo_install --git https://github.com/astral-sh/uv uv
48
52
if [ " Windows_NT" = " ${OS:- } " ]; then
49
53
mv $CARGO_HOME /bin/uv.exe $BIN_DIR /uv
50
54
mv $CARGO_HOME /bin/uvx.exe $BIN_DIR /uvx
@@ -53,4 +57,7 @@ if [ ! -f $BIN_DIR/uv ]; then
53
57
mv $CARGO_HOME /bin/uvx $BIN_DIR
54
58
fi
55
59
fi
60
+ if ! command -v uv 2> /dev/null; then
61
+ export PATH=" $PATH :$BIN_DIR "
62
+ fi
56
63
fi
0 commit comments