mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 13:25:00 +00:00
Select most recent wheel, most recent sdist (#190)
Select a compatible wheel for a version, even we already found a source distribution previously. If no wheel is found, select the most recent source distribution, not the oldest compatible one. This fixes the resolution of `mst.in`, which i added
This commit is contained in:
parent
13e4171916
commit
862c1654a0
3 changed files with 20 additions and 5 deletions
|
@ -531,10 +531,21 @@ impl<'a, Context: BuildContext> Resolver<'a, Context> {
|
|||
if let Ok(name) = WheelFilename::from_str(file.filename.as_str()) {
|
||||
if name.is_compatible(self.tags) {
|
||||
let version = PubGrubVersion::from(name.version);
|
||||
if let std::collections::btree_map::Entry::Vacant(entry) =
|
||||
version_map.entry(version)
|
||||
{
|
||||
entry.insert(DistributionFile::from(WheelFile::from(file)));
|
||||
|
||||
match version_map.entry(version) {
|
||||
std::collections::btree_map::Entry::Occupied(mut entry) => {
|
||||
if let DistributionFile::Sdist(_) = entry.get() {
|
||||
// Wheels get precedence over source distributions
|
||||
entry.insert(DistributionFile::from(
|
||||
WheelFile::from(file),
|
||||
));
|
||||
}
|
||||
}
|
||||
std::collections::btree_map::Entry::Vacant(entry) => {
|
||||
entry.insert(DistributionFile::from(WheelFile::from(
|
||||
file,
|
||||
)));
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if let Ok(name) = SourceDistributionFilename::parse(
|
||||
|
|
|
@ -153,13 +153,16 @@ impl CandidateSelector {
|
|||
file: file.clone(),
|
||||
});
|
||||
}
|
||||
DistributionFile::Sdist(_) => {
|
||||
DistributionFile::Sdist(_) if sdist.is_none() => {
|
||||
sdist = Some(Candidate {
|
||||
package_name: package_name.clone(),
|
||||
version: version.clone(),
|
||||
file: file.clone(),
|
||||
});
|
||||
}
|
||||
DistributionFile::Sdist(_) => {
|
||||
// We already selected a more recent source distribution
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
1
scripts/benchmarks/requirements/mst.in
Normal file
1
scripts/benchmarks/requirements/mst.in
Normal file
|
@ -0,0 +1 @@
|
|||
meine_stadt_transparent
|
Loading…
Add table
Add a link
Reference in a new issue