From 7ca5a3394efa68b6b3c05f48f7bab41a093cf8d4 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Fri, 25 Oct 2024 11:09:41 -0500 Subject: [PATCH] Use XDG (i.e. `~/.local/bin`) instead of the Cargo home directory in the installer (#8420) Reviving https://github.com/astral-sh/uv/pull/2236 Basically implements https://github.com/axodotdev/cargo-dist/issues/287 --- Cargo.toml | 2 +- docs/configuration/installer.md | 7 +++++-- docs/getting-started/installation.md | 6 +++--- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 782bdb2b7f16..22f1f23f7ad4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -333,4 +333,4 @@ github-custom-job-permissions = { "build-docker" = { packages = "write", content # Whether to install an updater program install-updater = false # Path that installers should place binaries in -install-path = "CARGO_HOME" +install-path = ["$XDG_BIN_HOME/", "$XDG_DATA_HOME/../bin", "~/.local/bin"] diff --git a/docs/configuration/installer.md b/docs/configuration/installer.md index 352689b5cc5a..76347741e57d 100644 --- a/docs/configuration/installer.md +++ b/docs/configuration/installer.md @@ -2,8 +2,11 @@ ## Changing the install path -By default, uv is installed to `~/.cargo/bin`. To change the installation path, use -`UV_INSTALL_DIR`: +By default, uv is installed to `~/.local/bin`. If `XDG_BIN_HOME` is set, it will be used instead. +Similarly, if `XDG_DATA_HOME` is set, the target directory will be inferred as +`XDG_DATA_HOME/../bin`. + +To change the installation path, use `UV_INSTALL_DIR`: === "macOS and Linux" diff --git a/docs/getting-started/installation.md b/docs/getting-started/installation.md index e89a1534e75d..ff0481bc1683 100644 --- a/docs/getting-started/installation.md +++ b/docs/getting-started/installation.md @@ -185,14 +185,14 @@ If you need to remove uv from your system, just remove the `uv` and `uvx` binari === "macOS and Linux" ```console - $ rm ~/.cargo/bin/uv ~/.cargo/bin/uvx + $ rm ~/.local/bin/uv ~/.local/bin/uvx ``` === "Windows" ```powershell - $ rm $HOME\.cargo\bin\uv.exe - $ rm $HOME\.cargo\bin\uvx.exe + $ rm $HOME\.local\bin\uv.exe + $ rm $HOME\.local\bin\uvx.exe ``` !!! tip