Skip to content

Commit

Permalink
Prefer more recent minor versions in wheel tags (astral-sh#2263)
Browse files Browse the repository at this point in the history
## Summary

In the list of tags produced by `Tags::from_env`, higher-priority tags
are expected to come earlier in the list. Right now, though, we push
tags like `py38` before `py312`. So if you run `cargo run pip install
multiprocess -n --reinstall --verbose` on Python 3.12, you get the
`py38` wheel rather than the `py32` wheel.

Closes astral-sh#2261.
  • Loading branch information
charliermarsh committed Mar 7, 2024
1 parent 5ae5980 commit 4796927
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/platform-tags/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ impl Tags {
// 2. abi3 and no abi (e.g. executable binary)
if matches!(implementation, Implementation::CPython) {
// For some reason 3.2 is the minimum python for the cp abi
for minor in 2..=python_version.1 {
for minor in (2..=python_version.1).rev() {
for platform_tag in &platform_tags {
tags.push((
implementation.language_tag((python_version.0, minor)),
Expand All @@ -124,7 +124,7 @@ impl Tags {
}
}
// 3. no abi (e.g. executable binary)
for minor in 0..=python_version.1 {
for minor in (0..=python_version.1).rev() {
for platform_tag in &platform_tags {
tags.push((
format!("py{}{}", python_version.0, minor),
Expand All @@ -142,7 +142,7 @@ impl Tags {
));
}
// 5. no binary
for minor in 0..=python_version.1 {
for minor in (0..=python_version.1).rev() {
tags.push((
format!("py{}{}", python_version.0, minor),
"none".to_string(),
Expand Down

0 comments on commit 4796927

Please sign in to comment.