summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorHarmen Stoppels <me@harmenstoppels.nl>2024-07-10 18:14:28 +0200
committerGitHub <noreply@github.com>2024-07-10 18:14:28 +0200
commite6f1b4e63a6011675921df984e02277c58a22c2b (patch)
tree7e6b24cc886c11e303c9120a509812c3b4ac95a5 /lib
parentc458e985affe020edf79c4e47f2156b0a1b7a308 (diff)
downloadspack-e6f1b4e63a6011675921df984e02277c58a22c2b.tar.gz
spack-e6f1b4e63a6011675921df984e02277c58a22c2b.tar.bz2
spack-e6f1b4e63a6011675921df984e02277c58a22c2b.tar.xz
spack-e6f1b4e63a6011675921df984e02277c58a22c2b.zip
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
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/package_base.py6
1 files changed, 3 insertions, 3 deletions
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):