From 7b644719c13c9ae73edf323d51643247aa942629 Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Wed, 10 Jul 2024 18:14:28 +0200 Subject: [PATCH] Avoid duplicate detectable tag (#45160) in case of inheritance the static tags prop may be updated multiple times, and it turns out builder classes magically inherit from traditional package classes --- lib/spack/spack/package_base.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/spack/spack/package_base.py b/lib/spack/spack/package_base.py index 9ea5da7ee6..c847bb069f 100644 --- a/lib/spack/spack/package_base.py +++ b/lib/spack/spack/package_base.py @@ -199,10 +199,10 @@ def __init__(cls, name, bases, attr_dict): # assumed to be detectable if hasattr(cls, "executables") or hasattr(cls, "libraries"): # Append a tag to each detectable package, so that finding them is faster - if hasattr(cls, "tags"): - getattr(cls, "tags").append(DetectablePackageMeta.TAG) - else: + if not hasattr(cls, "tags"): setattr(cls, "tags", [DetectablePackageMeta.TAG]) + elif DetectablePackageMeta.TAG not in cls.tags: + cls.tags.append(DetectablePackageMeta.TAG) @classmethod def platform_executables(cls):