summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2024-03-11 20:48:21 +0100
committerGitHub <noreply@github.com>2024-03-11 20:48:21 +0100
commitce75adada6cd3564d42d37bef19eb35dbf368e2a (patch)
tree9fd9cb47b736a319ef3ebb18955d3537499afc0c /var
parent24d37df1a25f0f6f61e2f12db661de6b67db75a0 (diff)
downloadspack-ce75adada6cd3564d42d37bef19eb35dbf368e2a.tar.gz
spack-ce75adada6cd3564d42d37bef19eb35dbf368e2a.tar.bz2
spack-ce75adada6cd3564d42d37bef19eb35dbf368e2a.tar.xz
spack-ce75adada6cd3564d42d37bef19eb35dbf368e2a.zip
Fix callbacks accumulation when using mixins with builders (#43100)
fixes #43097 Before this PR the behavior of mixins used together with builders was to mask completely the callbacks defined from the class coming later in the MRO. Here we fix the behavior by accumulating all callbacks, and de-duplicating them later.
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builder.test/packages/builder-and-mixins/package.py32
1 files changed, 32 insertions, 0 deletions
diff --git a/var/spack/repos/builder.test/packages/builder-and-mixins/package.py b/var/spack/repos/builder.test/packages/builder-and-mixins/package.py
new file mode 100644
index 0000000000..2e12b0e806
--- /dev/null
+++ b/var/spack/repos/builder.test/packages/builder-and-mixins/package.py
@@ -0,0 +1,32 @@
+# Copyright 2013-2024 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
+#
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+import spack.builder
+from spack.build_systems import generic
+from spack.package import *
+
+
+class BuilderAndMixins(Package):
+ """This package defines a mixin for its builder"""
+
+ homepage = "http://www.example.com"
+ url = "http://www.example.com/a-1.0.tar.gz"
+
+ version("2.0", md5="abcdef0123456789abcdef0123456789")
+ version("1.0", md5="0123456789abcdef0123456789abcdef")
+
+
+class BuilderMixin(metaclass=spack.builder.PhaseCallbacksMeta):
+ @run_before("install")
+ def before_install(self):
+ pass
+
+ @run_after("install")
+ def after_install(self):
+ pass
+
+
+class GenericBuilder(BuilderMixin, generic.GenericBuilder):
+ def install(self, pkg, spec, prefix):
+ pass