environment view use new traversal (#34662)

This commit is contained in:
Harmen Stoppels 2023-01-02 19:04:55 +01:00 committed by GitHub
parent 6984ee291a
commit 2e8d165120
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -532,18 +532,18 @@ def specs_for_view(self, concretized_root_specs):
From the list of concretized user specs in the environment, flatten From the list of concretized user specs in the environment, flatten
the dags, and filter selected, installed specs, remove duplicates on dag hash. the dags, and filter selected, installed specs, remove duplicates on dag hash.
""" """
specs = [] dag_hash = lambda spec: spec.dag_hash()
for s in concretized_root_specs: # With deps, requires traversal
if self.link == "all": if self.link == "all" or self.link == "run":
specs.extend(s.traverse(deptype=("link", "run"))) deptype = ("run") if self.link == "run" else ("link", "run")
elif self.link == "run": specs = list(
specs.extend(s.traverse(deptype=("run"))) spack.traverse.traverse_nodes(
else: concretized_root_specs, deptype=deptype, key=dag_hash
specs.append(s) )
)
# De-dupe by dag hash else:
specs = dedupe(specs, key=lambda s: s.dag_hash()) specs = list(dedupe(concretized_root_specs, key=dag_hash))
# Filter selected, installed specs # Filter selected, installed specs
with spack.store.db.read_transaction(): with spack.store.db.read_transaction():