summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorXavier Delaruelle <xavier.delaruelle@cea.fr>2023-03-20 09:23:40 +0100
committerGitHub <noreply@github.com>2023-03-20 09:23:40 +0100
commit41d7fe0a502db465c2eafaf2363c09fa4fcae075 (patch)
treeb4e208c46782448ebc53e8d35b6551a046165c74 /share
parent1af863a1e3176fa960297a02005a24fe975e4b82 (diff)
downloadspack-41d7fe0a502db465c2eafaf2363c09fa4fcae075.tar.gz
spack-41d7fe0a502db465c2eafaf2363c09fa4fcae075.tar.bz2
spack-41d7fe0a502db465c2eafaf2363c09fa4fcae075.tar.xz
spack-41d7fe0a502db465c2eafaf2363c09fa4fcae075.zip
modules tcl: fix autoload mechanism in template (#36237)
Adapt tcl modulefile template to call "module load" on autoload dependency without testing if this dependency is already loaded or not. The is-loaded test is not necessary, as module commands know how to cope with an already loaded module. With environment-modules 4.2+ (released in 2018) it is also important to have this "module load" command even if dependency is already loaded in order to record that the modulefile declares such dependency. This is important if you want to keep a consistent environment when a dependent module is unloaded. The "Autoloading" verbose message is also removed as recent module commands will report such information to the user (depending on the verbosity configured for the module command). Such change has been test successfully with Modules 3.2 (EL7), 4.5 (EL8) and 5.2 (latest) and also with Lmod 7 and 8 (as it is mentionned in Spack docs that Lmod can be used along with tcl modules). Dependencies are correctly loaded or unloaded, whether they are loaded/unloaded or not. This change fixes Tcl quoting issue introduced in #32853. Fixes #19155.
Diffstat (limited to 'share')
-rw-r--r--share/spack/templates/modules/modulefile.tcl7
1 files changed, 1 insertions, 6 deletions
diff --git a/share/spack/templates/modules/modulefile.tcl b/share/spack/templates/modules/modulefile.tcl
index 0970a1e594..de8d9e29bb 100644
--- a/share/spack/templates/modules/modulefile.tcl
+++ b/share/spack/templates/modules/modulefile.tcl
@@ -23,12 +23,7 @@ proc ModulesHelp { } {
{% block autoloads %}
{% for module in autoload %}
-if {{ '{' }} ![ is-loaded '{{ module }}' ] {{ '}' }} {{ '{' }}
-{% if verbose %}
- puts stderr "Autoloading {{ module }}"
-{% endif %}
- module load {{ module }}
-{{ '}' }}
+module load {{ module }}
{% endfor %}
{% endblock %}
{# #}