Modules suffixes config are now spec format strings (#38411)
This commit is contained in:
parent
37fe3b4984
commit
e5a602c1bb
@ -457,11 +457,11 @@ For instance, the following config options,
|
||||
tcl:
|
||||
all:
|
||||
suffixes:
|
||||
^python@3.12: 'python-3.12'
|
||||
^python@3: 'python{^python.version}'
|
||||
^openblas: 'openblas'
|
||||
|
||||
will add a ``python-3.12`` version string to any packages compiled with
|
||||
Python matching the spec, ``python@3.12``. This is useful to know which
|
||||
will add a ``python-3.12.1`` version string to any packages compiled with
|
||||
Python matching the spec, ``python@3``. This is useful to know which
|
||||
version of Python a set of Python extensions is associated with. Likewise, the
|
||||
``openblas`` string is attached to any program that has openblas in the spec,
|
||||
most likely via the ``+blas`` variant specification.
|
||||
|
@ -527,7 +527,8 @@ def use_name(self):
|
||||
parts = name.split("/")
|
||||
name = os.path.join(*parts)
|
||||
# Add optional suffixes based on constraints
|
||||
path_elements = [name] + self.conf.suffixes
|
||||
path_elements = [name]
|
||||
path_elements.extend(map(self.spec.format, self.conf.suffixes))
|
||||
return "-".join(path_elements)
|
||||
|
||||
@property
|
||||
|
9
lib/spack/spack/test/data/modules/tcl/suffix-format.yaml
Normal file
9
lib/spack/spack/test/data/modules/tcl/suffix-format.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
enable:
|
||||
- tcl
|
||||
tcl:
|
||||
all:
|
||||
autoload: none
|
||||
mpileaks:
|
||||
suffixes:
|
||||
mpileaks: 'debug={variants.debug.value}'
|
||||
'^mpi': 'mpi={^mpi.name}-v{^mpi.version}'
|
@ -377,6 +377,14 @@ def test_suffixes(self, module_configuration, factory):
|
||||
writer, spec = factory("mpileaks~debug+opt target=x86_64")
|
||||
assert "baz-foo-bar" in writer.layout.use_name
|
||||
|
||||
def test_suffixes_format(self, module_configuration, factory):
|
||||
"""Tests adding suffixes as spec format string to module file name."""
|
||||
module_configuration("suffix-format")
|
||||
|
||||
writer, spec = factory("mpileaks +debug target=x86_64 ^mpich@3.0.4")
|
||||
assert "debug=True" in writer.layout.use_name
|
||||
assert "mpi=mpich-v3.0.4" in writer.layout.use_name
|
||||
|
||||
def test_setup_environment(self, modulefile_content, module_configuration):
|
||||
"""Tests the internal set-up of run-time environment."""
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user