mirror of https://github.com/astral-sh/uv
Skip Python interpreters that cannot be queried with permission errors (#15685)
Closes https://github.com/astral-sh/uv/issues/15651
This commit is contained in:
parent
7dd035c555
commit
e136a51f3d
|
|
@ -1013,6 +1013,13 @@ impl Error {
|
|||
);
|
||||
false
|
||||
}
|
||||
InterpreterError::PermissionDenied { path, err } => {
|
||||
debug!(
|
||||
"Skipping unexecutable interpreter at {} from {source}: {err}",
|
||||
path.display()
|
||||
);
|
||||
false
|
||||
}
|
||||
InterpreterError::NotFound(path)
|
||||
| InterpreterError::BrokenSymlink(BrokenSymlink { path, .. }) => {
|
||||
// If the interpreter is from an active, valid virtual environment, we should
|
||||
|
|
|
|||
|
|
@ -797,6 +797,12 @@ pub enum Error {
|
|||
#[source]
|
||||
err: io::Error,
|
||||
},
|
||||
#[error("Failed to query Python interpreter at `{path}`")]
|
||||
PermissionDenied {
|
||||
path: PathBuf,
|
||||
#[source]
|
||||
err: io::Error,
|
||||
},
|
||||
#[error("{0}")]
|
||||
UnexpectedResponse(UnexpectedResponseError),
|
||||
#[error("{0}")]
|
||||
|
|
@ -911,8 +917,15 @@ impl InterpreterInfo {
|
|||
.arg(script)
|
||||
.output()
|
||||
.map_err(|err| {
|
||||
if err.kind() == io::ErrorKind::NotFound {
|
||||
return Error::NotFound(interpreter.to_path_buf());
|
||||
match err.kind() {
|
||||
io::ErrorKind::NotFound => return Error::NotFound(interpreter.to_path_buf()),
|
||||
io::ErrorKind::PermissionDenied => {
|
||||
return Error::PermissionDenied {
|
||||
path: interpreter.to_path_buf(),
|
||||
err,
|
||||
};
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
#[cfg(windows)]
|
||||
if let Some(APPMODEL_ERROR_NO_PACKAGE | ERROR_CANT_ACCESS_FILE) =
|
||||
|
|
|
|||
Loading…
Reference in New Issue