mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Avoid infinite loop for cyclic installs (#4633)
## Summary Closes https://github.com/astral-sh/uv/issues/4629. ## Test Plan Run `uv sync` with: ```toml [project] name = "foo" version = "0.1.0" requires-python = ">=3.9" dependencies = ["poetry"] ```
This commit is contained in:
parent
22ce8fdf4b
commit
164160da34
2 changed files with 192 additions and 4 deletions
|
@ -325,6 +325,7 @@ impl Lock {
|
|||
dev: &[GroupName],
|
||||
) -> Result<Resolution, LockError> {
|
||||
let mut queue: VecDeque<(&Distribution, Option<&ExtraName>)> = VecDeque::new();
|
||||
let mut seen = FxHashSet::default();
|
||||
|
||||
// Add the root distribution to the queue.
|
||||
let root = self
|
||||
|
@ -362,16 +363,17 @@ impl Lock {
|
|||
}),
|
||||
))
|
||||
};
|
||||
|
||||
for dep in deps {
|
||||
if dep
|
||||
.marker
|
||||
.as_ref()
|
||||
.map_or(true, |marker| marker.evaluate(marker_env, &[]))
|
||||
{
|
||||
let dep_dist = self.find_by_id(&dep.distribution_id);
|
||||
let dep_extra = dep.extra.as_ref();
|
||||
queue.push_back((dep_dist, dep_extra));
|
||||
if seen.insert((&dep.distribution_id, dep.extra.as_ref())) {
|
||||
let dep_dist = self.find_by_id(&dep.distribution_id);
|
||||
let dep_extra = dep.extra.as_ref();
|
||||
queue.push_back((dep_dist, dep_extra));
|
||||
}
|
||||
}
|
||||
}
|
||||
let name = dist.id.name.clone();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue