summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorMassimiliano Culpo <massimiliano.culpo@gmail.com>2023-04-14 10:59:12 +0200
committerGitHub <noreply@github.com>2023-04-14 10:59:12 +0200
commit9ec289857cd488c2de6f17537b7778052c2ab947 (patch)
tree51d6520fa6f01f153dade67ae4c3f01f511264a5 /lib
parent92144d637560a7442ce9811a1c7492e19dd38156 (diff)
downloadspack-9ec289857cd488c2de6f17537b7778052c2ab947.tar.gz
spack-9ec289857cd488c2de6f17537b7778052c2ab947.tar.bz2
spack-9ec289857cd488c2de6f17537b7778052c2ab947.tar.xz
spack-9ec289857cd488c2de6f17537b7778052c2ab947.zip
netcdf: fix bugs introduced with multiple build systems split (#36825)
Fixes #36689 - The "base" builder class should be last in the MRO - `filter_compiler_wrappers` needs to be moved to builders - Decorating a function from a mixin class require using the correct metaclass for the mixin
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/builder.py3
-rw-r--r--lib/spack/spack/mixins.py17
2 files changed, 11 insertions, 9 deletions
diff --git a/lib/spack/spack/builder.py b/lib/spack/spack/builder.py
index 44dac364e9..db6ca7aa4b 100644
--- a/lib/spack/spack/builder.py
+++ b/lib/spack/spack/builder.py
@@ -244,7 +244,8 @@ class PhaseCallbacksMeta(type):
callbacks_from_base = getattr(base, temporary_stage.attribute_name, None)
if callbacks_from_base:
break
- callbacks_from_base = callbacks_from_base or []
+ else:
+ callbacks_from_base = []
# Set the callbacks in this class and flush the temporary stage
attr_dict[temporary_stage.attribute_name] = staged_callbacks[:] + callbacks_from_base
diff --git a/lib/spack/spack/mixins.py b/lib/spack/spack/mixins.py
index 541a2ba1bd..189c3947ef 100644
--- a/lib/spack/spack/mixins.py
+++ b/lib/spack/spack/mixins.py
@@ -59,9 +59,10 @@ def filter_compiler_wrappers(*files, **kwargs):
find_kwargs = {"recursive": kwargs.get("recursive", False)}
- def _filter_compiler_wrappers_impl(self):
+ def _filter_compiler_wrappers_impl(pkg_or_builder):
+ pkg = getattr(pkg_or_builder, "pkg", pkg_or_builder)
# Compute the absolute path of the search root
- root = os.path.join(self.prefix, relative_root) if relative_root else self.prefix
+ root = os.path.join(pkg.prefix, relative_root) if relative_root else pkg.prefix
# Compute the absolute path of the files to be filtered and
# remove links from the list.
@@ -71,10 +72,10 @@ def filter_compiler_wrappers(*files, **kwargs):
x = llnl.util.filesystem.FileFilter(*abs_files)
compiler_vars = [
- ("CC", self.compiler.cc),
- ("CXX", self.compiler.cxx),
- ("F77", self.compiler.f77),
- ("FC", self.compiler.fc),
+ ("CC", pkg.compiler.cc),
+ ("CXX", pkg.compiler.cxx),
+ ("F77", pkg.compiler.f77),
+ ("FC", pkg.compiler.fc),
]
# Some paths to the compiler wrappers might be substrings of the others.
@@ -103,11 +104,11 @@ def filter_compiler_wrappers(*files, **kwargs):
x.filter(wrapper_path, compiler_path, **filter_kwargs)
# Remove this linking flag if present (it turns RPATH into RUNPATH)
- x.filter("{0}--enable-new-dtags".format(self.compiler.linker_arg), "", **filter_kwargs)
+ x.filter("{0}--enable-new-dtags".format(pkg.compiler.linker_arg), "", **filter_kwargs)
# NAG compiler is usually mixed with GCC, which has a different
# prefix for linker arguments.
- if self.compiler.name == "nag":
+ if pkg.compiler.name == "nag":
x.filter("-Wl,--enable-new-dtags", "", **filter_kwargs)
spack.builder.run_after(after)(_filter_compiler_wrappers_impl)