Repo.packages_with_tags: do not construct a set of all packages (#49141)

This commit is contained in:
Harmen Stoppels 2025-02-21 16:23:42 +01:00 committed by GitHub
parent f4614a4931
commit 0da5bafaf2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1179,8 +1179,9 @@ def all_package_paths(self) -> Generator[str, None, None]:
yield self.package_path(name)
def packages_with_tags(self, *tags: str) -> Set[str]:
v = set(self.all_package_names())
v.intersection_update(*(self.tag_index[tag.lower()] for tag in tags))
v = set(self.tag_index[tags[0].lower()])
for tag in tags[1:]:
v.intersection_update(self.tag_index[tag.lower()])
return v
def all_package_classes(self) -> Generator[Type["spack.package_base.PackageBase"], None, None]: