Remove the unused Error::LinkExecutable.to field (#18065)
Fixes https://github.com/astral-sh/uv/pull/18008/changes#r2813876103
This commit is contained in:
@@ -61,11 +61,7 @@ pub enum Error {
|
||||
#[error("Failed to create canonical Python executable")]
|
||||
CanonicalizeExecutable(#[source] io::Error),
|
||||
#[error("Failed to create Python executable link")]
|
||||
LinkExecutable {
|
||||
to: PathBuf,
|
||||
#[source]
|
||||
err: io::Error,
|
||||
},
|
||||
LinkExecutable(#[source] io::Error),
|
||||
#[error("Failed to create Python minor version link directory")]
|
||||
PythonMinorVersionLinkDirectory(#[source] io::Error),
|
||||
#[error("Failed to create directory for Python executable link")]
|
||||
@@ -927,10 +923,7 @@ pub fn create_link_to_executable(link: &Path, executable: &Path) -> Result<(), E
|
||||
Err(err) if err.kind() == io::ErrorKind::NotFound => {
|
||||
Err(Error::MissingExecutable(executable.to_path_buf()))
|
||||
}
|
||||
Err(err) => Err(Error::LinkExecutable {
|
||||
to: link.to_path_buf(),
|
||||
err,
|
||||
}),
|
||||
Err(err) => Err(Error::LinkExecutable(err)),
|
||||
}
|
||||
} else if cfg!(windows) {
|
||||
use uv_trampoline_builder::windows_python_launcher;
|
||||
@@ -944,10 +937,7 @@ pub fn create_link_to_executable(link: &Path, executable: &Path) -> Result<(), E
|
||||
{
|
||||
std::fs::File::create_new(link)
|
||||
.and_then(|mut file| file.write_all(launcher.as_ref()))
|
||||
.map_err(|err| Error::LinkExecutable {
|
||||
to: link.to_path_buf(),
|
||||
err,
|
||||
})
|
||||
.map_err(Error::LinkExecutable)
|
||||
}
|
||||
} else {
|
||||
unimplemented!("Only Windows and Unix are supported.")
|
||||
@@ -964,19 +954,13 @@ pub fn replace_link_to_executable(link: &Path, executable: &Path) -> Result<(),
|
||||
fs_err::create_dir_all(link_parent).map_err(Error::ExecutableDirectory)?;
|
||||
|
||||
if cfg!(unix) {
|
||||
replace_symlink(executable, link).map_err(|err| Error::LinkExecutable {
|
||||
to: link.to_path_buf(),
|
||||
err,
|
||||
})
|
||||
replace_symlink(executable, link).map_err(Error::LinkExecutable)
|
||||
} else if cfg!(windows) {
|
||||
use uv_trampoline_builder::windows_python_launcher;
|
||||
|
||||
let launcher = windows_python_launcher(executable, false)?;
|
||||
|
||||
uv_fs::write_atomic_sync(link, &*launcher).map_err(|err| Error::LinkExecutable {
|
||||
to: link.to_path_buf(),
|
||||
err,
|
||||
})
|
||||
uv_fs::write_atomic_sync(link, &*launcher).map_err(Error::LinkExecutable)
|
||||
} else {
|
||||
unimplemented!("Only Windows and Unix are supported.")
|
||||
}
|
||||
|
||||
@@ -1021,7 +1021,7 @@ fn create_bin_links(
|
||||
.or_default()
|
||||
.insert(target.clone());
|
||||
}
|
||||
Err(uv_python::managed::Error::LinkExecutable { to, err })
|
||||
Err(uv_python::managed::Error::LinkExecutable(err))
|
||||
if err.kind() == ErrorKind::AlreadyExists =>
|
||||
{
|
||||
debug!(
|
||||
@@ -1059,7 +1059,7 @@ fn create_bin_links(
|
||||
if upgrade {
|
||||
warn_user!(
|
||||
"Executable already exists at `{}` but is not managed by uv; use `uv python install {}.{}{} --force` to replace it",
|
||||
to.simplified_display(),
|
||||
target.simplified_display(),
|
||||
installation.key().major(),
|
||||
installation.key().minor(),
|
||||
installation.key().variant().display_suffix()
|
||||
@@ -1070,7 +1070,7 @@ fn create_bin_links(
|
||||
installation.key().clone(),
|
||||
anyhow::anyhow!(
|
||||
"Executable already exists at `{}` but is not managed by uv; use `--force` to replace it",
|
||||
to.simplified_display()
|
||||
target.simplified_display()
|
||||
),
|
||||
));
|
||||
}
|
||||
@@ -1133,7 +1133,7 @@ fn create_bin_links(
|
||||
debug!(
|
||||
"Executable already exists for `{}` at `{}`. Use `--force` to replace it",
|
||||
existing.key(),
|
||||
to.simplified_display()
|
||||
target.simplified_display()
|
||||
);
|
||||
continue;
|
||||
}
|
||||
@@ -1142,13 +1142,13 @@ fn create_bin_links(
|
||||
}
|
||||
|
||||
// Replace the existing link
|
||||
if let Err(err) = fs_err::remove_file(&to) {
|
||||
if let Err(err) = fs_err::remove_file(&target) {
|
||||
errors.push((
|
||||
InstallErrorKind::Bin,
|
||||
installation.key().clone(),
|
||||
anyhow::anyhow!(
|
||||
"Executable already exists at `{}` but could not be removed: {err}",
|
||||
to.simplified_display()
|
||||
target.simplified_display()
|
||||
),
|
||||
));
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user