mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 02:48:17 +00:00
Refactor uv python install
(#8701)
Pulling out of https://github.com/astral-sh/uv/pull/8650 for readability. Trying to clean this up to simplify extensions in the future. This is not a strict refactor, there are behavioral changes here. - Adds some structs for managing state. - Addresses some likely inconsistent behavior for weird edge-cases. - We fill platform information before checking if a request is satisfied. - We error earlier if we can't find a download for the request, i.e., even if you somehow have it installed. - Only reports versions as uninstalled if a download actually replaces them. - Moves some of the default output to tracing messages. - Even if an installation was already satisfied, we'll check that it is setup properly
This commit is contained in:
parent
bed47d512a
commit
893257bb0b
3 changed files with 261 additions and 177 deletions
|
@ -423,7 +423,7 @@ pub enum DownloadResult {
|
|||
}
|
||||
|
||||
impl ManagedPythonDownload {
|
||||
/// Return the first [`PythonDownload`] matching a request, if any.
|
||||
/// Return the first [`ManagedPythonDownload`] matching a request, if any.
|
||||
pub fn from_request(
|
||||
request: &PythonDownloadRequest,
|
||||
) -> Result<&'static ManagedPythonDownload, Error> {
|
||||
|
@ -433,7 +433,7 @@ impl ManagedPythonDownload {
|
|||
.ok_or(Error::NoDownloadFound(request.clone()))
|
||||
}
|
||||
|
||||
/// Iterate over all [`PythonDownload`]'s.
|
||||
/// Iterate over all [`ManagedPythonDownload`]s.
|
||||
pub fn iter_all() -> impl Iterator<Item = &'static ManagedPythonDownload> {
|
||||
PYTHON_DOWNLOADS
|
||||
.iter()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue