Add prerelease compatibility check (#8020)

## Summary

Closes #7977. Makes `PythonDownloadRequest` account for the prerelease
part if allowed. Also stores the prerelease in `PythonInstallationKey`
directly as a `Prerelease` rather than a string.

## Test Plan

Correctly picks the relevant prerelease (rather than picking the most
recent one):
```
λ cargo run python install 3.13.0rc2
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.17s
     Running `target/debug/uv python install 3.13.0rc2`
Searching for Python versions matching: Python 3.13rc2
cpython-3.13.0rc2-macos-aarch64-none ------------------------------ 457.81 KiB/14.73 MiB                                                                                                                    ^C

λ cargo run python install 3.13.0rc3                 
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.17s
     Running `target/debug/uv python install 3.13.0rc3`
Searching for Python versions matching: Python 3.13rc3
Found existing installation for Python 3.13rc3: cpython-3.13.0rc3-macos-aarch64-none
```
This commit is contained in:
trag1c 2024-10-08 23:20:58 +02:00 committed by GitHub
parent cfaa834dee
commit 37273cb4bc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 794 additions and 768 deletions

View file

@ -157,10 +157,7 @@ impl Interpreter {
self.python_major(),
self.python_minor(),
self.python_patch(),
self.python_version()
.pre()
.map(|pre| pre.to_string())
.unwrap_or_default(),
self.python_version().pre(),
self.os(),
self.arch(),
self.libc(),