From e6f1b4e63a6011675921df984e02277c58a22c2b Mon Sep 17 00:00:00 2001 From: Harmen Stoppels Date: Wed, 10 Jul 2024 18:14:28 +0200 Subject: 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(-) (limited to 'lib') diff --git a/lib/spack/spack/package_base.py b/lib/spack/spack/package_base.py index 50ea97a9d4..82d04afb97 100644 --- a/lib/spack/spack/package_base.py +++ b/lib/spack/spack/package_base.py @@ -199,10 +199,10 @@ class DetectablePackageMeta(type): # 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): -- cgit v1.2.3-70-g09d2