Skip to content

Commit

Permalink
Tweak installation language in toolchain install
Browse files Browse the repository at this point in the history
  • Loading branch information
charliermarsh committed Jul 4, 2024
1 parent 35afcfd commit d11dcc1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions crates/uv-python/src/downloads.rs
Original file line number Diff line number Diff line change
Expand Up @@ -397,15 +397,15 @@ impl ManagedPythonDownload {
parent_path: &Path,
) -> Result<DownloadResult, Error> {
let url = Url::parse(self.url)?;
let path = parent_path.join(self.key().to_string()).clone();
let path = parent_path.join(self.key().to_string());

// If it already exists, return it
if path.is_dir() {
return Ok(DownloadResult::AlreadyAvailable(path));
}

let filename = url.path_segments().unwrap().last().unwrap();
let response = client.get(url.clone()).send().await?;
let response = client.get(url).send().await?;

// Ensure the request was successful.
response.error_for_status_ref()?;
Expand All @@ -419,7 +419,7 @@ impl ManagedPythonDownload {
);
let reader = response
.bytes_stream()
.map_err(|err| std::io::Error::new(std::io::ErrorKind::Other, err))
.map_err(|err| io::Error::new(io::ErrorKind::Other, err))
.into_async_read();

debug!("Extracting {filename}");
Expand Down
17 changes: 7 additions & 10 deletions crates/uv/src/commands/python/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ pub(crate) async fn install(
{
writeln!(
printer.stderr(),
"Found installed installation `{}` that satisfies {request}",
"Found existing installation `{}` that satisfies {request}",
installation.key()
)?;
if force {
writeln!(
printer.stderr(),
"Removing installed installation `{}`",
"Removing existing installation `{}`",
installation.key()
)?;
fs::remove_dir_all(installation.path())?;
Expand All @@ -88,26 +88,23 @@ pub(crate) async fn install(
if matches!(requests.as_slice(), [PythonRequest::Any]) {
writeln!(
printer.stderr(),
"A installation is already installed. Use `uv installation install <request>` to install a specific installation.",
"Python is already available. Use `uv python install <request>` to install a specific version.",
)?;
} else if requests.len() > 1 {
writeln!(
printer.stderr(),
"All requested installations already installed."
"All requested versions already installed."
)?;
} else {
writeln!(
printer.stderr(),
"Requested installation already installed."
)?;
writeln!(printer.stderr(), "Requested versions already installed.")?;
}
return Ok(ExitStatus::Success);
}

if unfilled_requests.len() > 1 {
writeln!(
printer.stderr(),
"Found {}/{} installations requiring installation",
"Found {}/{} versions requiring installation",
unfilled_requests.len(),
requests.len()
)?;
Expand Down Expand Up @@ -158,7 +155,7 @@ pub(crate) async fn install(
let s = if downloads.len() == 1 { "" } else { "s" };
writeln!(
printer.stderr(),
"Installed {} installation{s} in {}s",
"Installed {} version{s} in {}s",
downloads.len(),
start.elapsed().as_secs()
)?;
Expand Down
5 changes: 4 additions & 1 deletion crates/uv/src/commands/python/uninstall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,10 @@ pub(crate) async fn uninstall(

if failed {
if matching_installations.len() > 1 {
writeln!(printer.stderr(), "Some Python uninstalls failed")?;
writeln!(
printer.stderr(),
"Failed to remove some Python installations"
)?;
}
return Ok(ExitStatus::Failure);
}
Expand Down

0 comments on commit d11dcc1

Please sign in to comment.