Avoid enumerating sources in errors for path Python requests (#13335)

e.g., these are misleading cruft in the error message at
https://github.com/astral-sh/uv/pull/12168#discussion_r2078204601

```
❯ uv python find /foo/bar
error: No interpreter found for path `/foo/bar` in virtual environments, managed installations, or search path
❯ cargo run -q -- python find /foo/bar
error: No interpreter found at path `/foo/bar`
```
This commit is contained in:
Zanie Blue 2025-05-07 13:53:09 -05:00 committed by GitHub
parent 364e3999d4
commit fa8db5a8d0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 61 additions and 2 deletions

View file

@ -2646,6 +2646,12 @@ impl fmt::Display for PythonNotFound {
PythonRequest::Default | PythonRequest::Any => {
write!(f, "No interpreter found in {sources}")
}
PythonRequest::File(_) => {
write!(f, "No interpreter found at {}", self.request)
}
PythonRequest::Directory(_) => {
write!(f, "No interpreter found in {}", self.request)
}
_ => {
write!(f, "No interpreter found for {} in {sources}", self.request)
}