Misc. touch-ups to target-to-resolution routine (#9131)

This commit is contained in:
Charlie Marsh 2024-11-14 16:24:03 -05:00 committed by GitHub
parent fe477c3417
commit 92735ced9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 5 deletions

View File

@ -216,7 +216,7 @@ impl<'env> InstallTarget<'env> {
let dep_dist = self.lock().find_by_id(&dep.package_id); let dep_dist = self.lock().find_by_id(&dep.package_id);
// Add the dependency to the graph. // Add the package to the graph.
let dep_index = match inverse.entry(&dep.package_id) { let dep_index = match inverse.entry(&dep.package_id) {
Entry::Vacant(entry) => { Entry::Vacant(entry) => {
let index = petgraph.add_node(self.package_to_node( let index = petgraph.add_node(self.package_to_node(
@ -275,7 +275,7 @@ impl<'env> InstallTarget<'env> {
name: root_name.clone(), name: root_name.clone(),
})?; })?;
// Add the workspace package to the graph. // Add the package to the graph.
let index = match inverse.entry(&dist.id) { let index = match inverse.entry(&dist.id) {
Entry::Vacant(entry) => { Entry::Vacant(entry) => {
let index = petgraph.add_node(self.package_to_node( let index = petgraph.add_node(self.package_to_node(
@ -293,7 +293,7 @@ impl<'env> InstallTarget<'env> {
} }
}; };
// Add an edge from the root. // Add the edge.
petgraph.add_edge( petgraph.add_edge(
root, root,
index, index,
@ -301,9 +301,13 @@ impl<'env> InstallTarget<'env> {
); );
// Push its dependencies on the queue. // Push its dependencies on the queue.
queue.push_back((dist, None)); if seen.insert((&dist.id, None)) {
queue.push_back((dist, None));
}
for extra in &dependency.extras { for extra in &dependency.extras {
queue.push_back((dist, Some(extra))); if seen.insert((&dist.id, Some(extra))) {
queue.push_back((dist, Some(extra)));
}
} }
} }
} }