mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-07 21:35:00 +00:00
Avoid pre-fetching for unbounded minimum versions (#4149)
## Summary I think we should be able to model PubGrub such that this isn't necessary (at least for the case described in the issue), but for now, let's just avoid attempting to build very old distributions in prefetching. Closes https://github.com/astral-sh/uv/issues/4136.
This commit is contained in:
parent
d7cc622d6c
commit
0db1bf4df7
2 changed files with 17 additions and 1 deletions
|
@ -3,6 +3,7 @@
|
|||
use std::borrow::Cow;
|
||||
use std::collections::BTreeMap;
|
||||
use std::fmt::{Display, Formatter};
|
||||
use std::ops::Bound;
|
||||
use std::sync::Arc;
|
||||
use std::thread;
|
||||
|
||||
|
@ -1402,6 +1403,20 @@ impl<InstalledPackages: InstalledPackagesProvider> ResolverState<InstalledPackag
|
|||
return Ok(None);
|
||||
};
|
||||
|
||||
// Avoid prefetching source distributions with unbounded lower-bound ranges. This
|
||||
// often leads to failed attempts to build legacy versions of packages that are
|
||||
// incompatible with modern build tools.
|
||||
if !dist.prefetchable() {
|
||||
if !self.selector.use_highest_version(&package_name) {
|
||||
if let Some((lower, _)) = range.iter().next() {
|
||||
if lower == &Bound::Unbounded {
|
||||
debug!("Skipping prefetch for unbounded minimum-version range: {package_name} ({range})");
|
||||
return Ok(None);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Emit a request to fetch the metadata for this version.
|
||||
if self.index.distributions().register(candidate.version_id()) {
|
||||
let dist = dist.for_resolution().to_owned();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue