environment.py: concrete root specs to view (#29634)

Slight simplification of the code: just pass the list of concrete root
specs to the view
This commit is contained in:
Harmen Stoppels 2022-03-24 14:59:24 +01:00 committed by GitHub
parent 1a728c98ff
commit f8224f284c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -474,14 +474,14 @@ def __contains__(self, spec):
return True return True
def specs_for_view(self, concretized_specs): 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 = [] specs = []
for (_, s) in concretized_specs: for s in concretized_root_specs:
if self.link == 'all': if self.link == 'all':
specs.extend(s.traverse(deptype=('link', 'run'))) specs.extend(s.traverse(deptype=('link', 'run')))
elif self.link == 'run': elif self.link == 'run':
@ -498,8 +498,8 @@ def specs_for_view(self, concretized_specs):
return specs return specs
def regenerate(self, concretized_specs): def regenerate(self, concretized_root_specs):
specs = self.specs_for_view(concretized_specs) specs = self.specs_for_view(concretized_root_specs)
# To ensure there are no conflicts with packages being installed # To ensure there are no conflicts with packages being installed
# that cannot be resolved or have repos that have been removed # that cannot be resolved or have repos that have been removed
@ -1321,8 +1321,9 @@ def regenerate_views(self):
" maintain a view") " maintain a view")
return return
concretized_root_specs = [s for _, s in self.concretized_specs()]
for view in self.views.values(): for view in self.views.values():
view.regenerate(self.concretized_specs()) view.regenerate(concretized_root_specs)
def check_views(self): def check_views(self):
"""Checks if the environments default view can be activated.""" """Checks if the environments default view can be activated."""