From cdc82361696a6d7b66b70ef2f03632ceffcbf63c Mon Sep 17 00:00:00 2001 From: Massimiliano Culpo Date: Wed, 16 Oct 2024 14:55:28 +0200 Subject: [PATCH] Make BaseConfiguration pickleable Signed-off-by: Massimiliano Culpo --- lib/spack/spack/modules/common.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/spack/spack/modules/common.py b/lib/spack/spack/modules/common.py index 0d1ef70127e..a0e01fc4f54 100644 --- a/lib/spack/spack/modules/common.py +++ b/lib/spack/spack/modules/common.py @@ -330,18 +330,17 @@ class BaseConfiguration: default_projections = {"all": "{name}/{version}-{compiler.name}-{compiler.version}"} def __init__(self, spec: spack.spec.Spec, module_set_name: str, explicit: bool) -> None: - # Module where type(self) is defined - m = inspect.getmodule(self) - assert m is not None # make mypy happy - self.module = m # Spec for which we want to generate a module file self.spec = spec self.name = module_set_name self.explicit = explicit - # Dictionary of configuration options that should be applied - # to the spec + # Dictionary of configuration options that should be applied to the spec self.conf = merge_config_rules(self.module.configuration(self.name), self.spec) + @property + def module(self): + return inspect.getmodule(self) + @property def projections(self): """Projection from specs to module names"""