Make BaseConfiguration pickleable

Signed-off-by: Massimiliano Culpo <massimiliano.culpo@gmail.com>
This commit is contained in:
Massimiliano Culpo 2024-10-16 14:55:28 +02:00
parent f8ab75244b
commit cdc8236169
No known key found for this signature in database
GPG Key ID: 3E52BB992233066C

View File

@ -330,18 +330,17 @@ class BaseConfiguration:
default_projections = {"all": "{name}/{version}-{compiler.name}-{compiler.version}"} default_projections = {"all": "{name}/{version}-{compiler.name}-{compiler.version}"}
def __init__(self, spec: spack.spec.Spec, module_set_name: str, explicit: bool) -> None: 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 # Spec for which we want to generate a module file
self.spec = spec self.spec = spec
self.name = module_set_name self.name = module_set_name
self.explicit = explicit self.explicit = explicit
# Dictionary of configuration options that should be applied # Dictionary of configuration options that should be applied to the spec
# to the spec
self.conf = merge_config_rules(self.module.configuration(self.name), self.spec) self.conf = merge_config_rules(self.module.configuration(self.name), self.spec)
@property
def module(self):
return inspect.getmodule(self)
@property @property
def projections(self): def projections(self):
"""Projection from specs to module names""" """Projection from specs to module names"""