summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorXavier Delaruelle <xavier.delaruelle@cea.fr>2023-10-26 15:55:49 +0200
committerGitHub <noreply@github.com>2023-10-26 15:55:49 +0200
commit751b64cbcdb86ce94a05503e853f788b94aaeb11 (patch)
tree266237d5fcea216a8fd6c4f9bfe7d653b24a268a /share
parentf57c2501a38134f1b1ec70384b3efc6fd1124468 (diff)
downloadspack-751b64cbcdb86ce94a05503e853f788b94aaeb11.tar.gz
spack-751b64cbcdb86ce94a05503e853f788b94aaeb11.tar.bz2
spack-751b64cbcdb86ce94a05503e853f788b94aaeb11.tar.xz
spack-751b64cbcdb86ce94a05503e853f788b94aaeb11.zip
modules: no --delim option if separator is colon character (#39010)
Update Tcl modulefile template to simplify generated `append-path`, `prepend-path` and `remove-path` commands and improve their readability. If path element delimiter is colon character, do not set the `--delim` option as it is the default delimiter value.
Diffstat (limited to 'share')
-rw-r--r--share/spack/templates/modules/modulefile.tcl14
1 files changed, 13 insertions, 1 deletions
diff --git a/share/spack/templates/modules/modulefile.tcl b/share/spack/templates/modules/modulefile.tcl
index 746fea2f31..d1593b8828 100644
--- a/share/spack/templates/modules/modulefile.tcl
+++ b/share/spack/templates/modules/modulefile.tcl
@@ -54,11 +54,23 @@ conflict {{ name }}
{% block environment %}
{% for command_name, cmd in environment_modifications %}
{% if command_name == 'PrependPath' %}
+{% if cmd.separator == ':' %}
+prepend-path {{ cmd.name }} {{ '{' }}{{ cmd.value }}{{ '}' }}
+{% else %}
prepend-path --delim {{ '{' }}{{ cmd.separator }}{{ '}' }} {{ cmd.name }} {{ '{' }}{{ cmd.value }}{{ '}' }}
+{% endif %}
{% elif command_name in ('AppendPath', 'AppendFlagsEnv') %}
+{% if cmd.separator == ':' %}
+append-path {{ cmd.name }} {{ '{' }}{{ cmd.value }}{{ '}' }}
+{% else %}
append-path --delim {{ '{' }}{{ cmd.separator }}{{ '}' }} {{ cmd.name }} {{ '{' }}{{ cmd.value }}{{ '}' }}
+{% endif %}
{% elif command_name in ('RemovePath', 'RemoveFlagsEnv') %}
+{% if cmd.separator == ':' %}
+remove-path {{ cmd.name }} {{ '{' }}{{ cmd.value }}{{ '}' }}
+{% else %}
remove-path --delim {{ '{' }}{{ cmd.separator }}{{ '}' }} {{ cmd.name }} {{ '{' }}{{ cmd.value }}{{ '}' }}
+{% endif %}
{% elif command_name == 'SetEnv' %}
setenv {{ cmd.name }} {{ '{' }}{{ cmd.value }}{{ '}' }}
{% elif command_name == 'UnsetEnv' %}
@@ -68,7 +80,7 @@ unsetenv {{ cmd.name }}
{% endfor %}
{# Make sure system man pages are enabled by appending trailing delimiter to MANPATH #}
{% if has_manpath_modifications %}
-append-path --delim {{ '{' }}:{{ '}' }} MANPATH {{ '{' }}{{ '}' }}
+append-path MANPATH {{ '{' }}{{ '}' }}
{% endif %}
{% endblock %}