Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions .evergreen/install-cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ pushd $SCRIPT_DIR >/dev/null

# First ensure we have a python binary.
if [ -z "${DRIVERS_TOOLS_PYTHON:-}" ]; then
. ./find-python3.sh
. ./find-python3.sh

echo "Ensuring python binary..."
DRIVERS_TOOLS_PYTHON="$(ensure_python3 2>/dev/null)"
Expand All @@ -27,7 +27,7 @@ if [ -z "${DRIVERS_TOOLS_PYTHON:-}" ]; then
exit 1
fi
echo "Using python $DRIVERS_TOOLS_PYTHON"
echo "DRIVERS_TOOLS_PYTHON=$DRIVERS_TOOLS_PYTHON" >> $DRIVERS_TOOLS/.env
echo "DRIVERS_TOOLS_PYTHON=$DRIVERS_TOOLS_PYTHON" >>$DRIVERS_TOOLS/.env
echo "Ensuring python binary... done."
fi
export UV_PYTHON=$DRIVERS_TOOLS_PYTHON
Expand All @@ -46,17 +46,19 @@ fi
# If uv is not on path, try see if it is available from the Python toolchain.
if ! command -v uv &>/dev/null; then
export PATH
declare python_path
case "${OSTYPE:?}" in
cygwin)
PATH="/cygdrive/c/Python/Current/Scripts:${PATH:-}"
python_path="/cygdrive/c/Python/Current/Scripts"
;;
darwin*)
PATH="/Library/Frameworks/Python.Framework/Versions/Current/bin:${PATH:-}"
python_path="/Library/Frameworks/Python.Framework/Versions/Current/bin"
;;
*)
PATH="/opt/python/Current/bin:${PATH:-}"
python_path="/opt/python/Current/bin"
;;
esac
[[ "${PATH:-}" =~ (^|:)"${python_path:?}"(:|$) ]] || PATH="${python_path:?}:${PATH:-}"
fi

# If there is still no uv, we will install it to $DRIVERS_TOOLS/.bin.
Expand Down Expand Up @@ -109,7 +111,7 @@ export UV_TOOL_BIN_DIR

# Pin the uv binary version used by subsequent commands.
uv tool install -q --force "uv~=0.8.0"
PATH="${UV_TOOL_BIN_DIR:?}:${PATH:-}"
[[ "${PATH:-}" =~ (^|:)"${UV_TOOL_BIN_DIR:?}"(:|$) ]] || PATH="${UV_TOOL_BIN_DIR:?}:${PATH:-}"
command -V uv
uv --version

Expand All @@ -132,7 +134,15 @@ uv_install_args=(
uv tool install "${uv_install_args[@]:?}" .

# Support running tool executables on Windows without including the ".exe" suffix.
find . -maxdepth 1 -type f -name '*.exe' -exec \
bash -c "ln -sf \"\$0\" \"\$(echo \"\$0\" | sed -E -e 's|(.*)\.exe|\1|')\"" {} \;
(
for name_exe in *.exe; do
# Skip files which do not exist or are not executable.
[[ -x "${name_exe:?}" ]] || continue
# Strip ".exe" at end of filename.
name="${name_exe%".exe"}"
# Only create a symlink if the symlink doesn't already exist.
[[ -x "${name:?}" ]] || ln -sf "${name_exe:?}" "${name:?}"
done
)

popd >/dev/null # "$TARGET_DIR"
Loading