Skip to content

Commit

Permalink
Improve message when updater receipt is for a different uv executable
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb committed Nov 27, 2024
1 parent 766f2bf commit d39c4a5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
3 changes: 1 addition & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async-compression = { version = "0.4.12", features = ["bzip2", "gzip", "xz", "zs
async-trait = { version = "0.1.82" }
async_http_range_reader = { version = "0.9.1" }
async_zip = { git = "https://github.com/charliermarsh/rs-async-zip", rev = "c909fda63fcafe4af496a07bfda28a5aae97e58d", features = ["deflate", "tokio"] }
axoupdater = { version = "0.8.0", default-features = false }
axoupdater = { git = "https://github.com/axodotdev/axoupdater", rev = "9c43536f34df2b1a588ef5249222902d884d5ad2", default-features = false }
backoff = { version = "0.4.0" }
base64 = { version = "0.22.1" }
bitflags = { version = "2.6.0" }
Expand Down
13 changes: 8 additions & 5 deletions crates/uv/src/commands/self_update.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use owo_colors::OwoColorize;
use tracing::debug;

use uv_client::WrappedReqwestError;
use uv_fs::Simplified;

use crate::commands::ExitStatus;
use crate::printer::Printer;
Expand Down Expand Up @@ -48,9 +49,9 @@ pub(crate) async fn self_update(
// uv binaries installed, and the current binary was _not_ installed via the standalone
// installation scripts.
if !updater.check_receipt_is_for_this_executable()? {
debug!(
"receipt is not for this executable; assuming uv was installed via a package manager"
);
let current_exe = std::env::current_exe()?;
let receipt_prefix = updater.install_prefix_root()?;

writeln!(
printer.stderr(),
"{}",
Expand All @@ -59,10 +60,12 @@ pub(crate) async fn self_update(
"{}{} Self-update is only available for uv binaries installed via the standalone installation scripts.",
"\n",
"\n",
"If you installed uv with pip, brew, or another package manager, update uv with `pip install --upgrade`, `brew upgrade`, or similar."
"The current executable is at `{}` but the standalone installer was used to install uv to `{}`. Are multiple copies of uv installed?"
),
"warning".yellow().bold(),
":".bold()
":".bold(),
current_exe.simplified_display().bold().cyan(),
receipt_prefix.simplified_display().bold().cyan()
)
)?;
return Ok(ExitStatus::Error);
Expand Down

0 comments on commit d39c4a5

Please sign in to comment.