Skip to content

Commit 8a621f2

Browse files
committed
clean up install
1 parent de92978 commit 8a621f2

File tree

1 file changed

+26
-36
lines changed

1 file changed

+26
-36
lines changed

.evergreen/install-dependencies.sh

Lines changed: 26 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,60 +4,50 @@ set -eu
44
# Set where binaries are expected to be.
55
# On Evergreen jobs, "CI" will be set, and we don't want to write to $HOME.
66
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.
812
else
9-
BIN_DIR=$HOME/.local/bin
13+
_BIN_DIR=$HOME/.local/bin
1014
fi
15+
mkdir -p $_BIN_DIR 2>/dev/null || true
1116

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+
}
1225

1326
_CURL_ARGS="--tlsv1.2 -LsSf"
1427

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-
2328
# Install just.
2429
if ! command -v just 2>/dev/null; then
2530
if [ "Windows_NT" = "${OS:-}" ]; then
26-
TARGET="--target x86_64-pc-windows-msvc"
31+
_TARGET="--target x86_64-pc-windows-msvc"
2732
else
28-
TARGET=""
33+
_TARGET=""
2934
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
3738
}
3839
if ! command -v just 2>/dev/null; then
39-
export PATH="$PATH:$BIN_DIR"
40+
export PATH="$PATH:$_BIN_DIR"
4041
fi
4142
fi
4243

4344
# Install uv.
4445
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+
}
6050
if ! command -v uv 2>/dev/null; then
61-
export PATH="$PATH:$BIN_DIR"
51+
export PATH="$PATH:$_BIN_DIR"
6252
fi
6353
fi

0 commit comments

Comments
 (0)