summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorXavier Delaruelle <xavier.delaruelle@cea.fr>2023-03-24 10:28:10 +0100
committerGitHub <noreply@github.com>2023-03-24 10:28:10 +0100
commit906151075d472bd6a18f85780820d0b3dce3f800 (patch)
tree1eef2964534a9b19a3d6fdb131abaa2879cf1219 /share
parentd0d5526110e64e883c7c76d64cc4b6f72494a93a (diff)
downloadspack-906151075d472bd6a18f85780820d0b3dce3f800.tar.gz
spack-906151075d472bd6a18f85780820d0b3dce3f800.tar.bz2
spack-906151075d472bd6a18f85780820d0b3dce3f800.tar.xz
spack-906151075d472bd6a18f85780820d0b3dce3f800.zip
modules tcl: simplify env modification block in template (#36334)
Simplify environment modification block in modulefile Tcl template by always setting a path delimiter to the prepend-path, append-path and remove-path commands. Remove --delim option to the setenv command as this command does not allow such option. Update test_prepend_path_separator test to explicitly check the 6 path-like commands that should be present in generated modulefile.
Diffstat (limited to 'share')
-rw-r--r--share/spack/templates/modules/modulefile.tcl16
1 files changed, 0 insertions, 16 deletions
diff --git a/share/spack/templates/modules/modulefile.tcl b/share/spack/templates/modules/modulefile.tcl
index de8d9e29bb..be53856ba7 100644
--- a/share/spack/templates/modules/modulefile.tcl
+++ b/share/spack/templates/modules/modulefile.tcl
@@ -41,8 +41,6 @@ conflict {{ name }}
{% block environment %}
{% for command_name, cmd in environment_modifications %}
-{% if cmd.separator != ':' %}
-{# A non-standard separator is required #}
{% if command_name == 'PrependPath' %}
prepend-path --delim "{{ cmd.separator }}" {{ cmd.name }} "{{ cmd.value }}"
{% elif command_name == 'AppendPath' %}
@@ -50,25 +48,11 @@ append-path --delim "{{ cmd.separator }}" {{ cmd.name }} "{{ cmd.value }}"
{% elif command_name == 'RemovePath' %}
remove-path --delim "{{ cmd.separator }}" {{ cmd.name }} "{{ cmd.value }}"
{% elif command_name == 'SetEnv' %}
-setenv --delim "{{ cmd.separator }}" {{ cmd.name }} "{{ cmd.value }}"
-{% elif command_name == 'UnsetEnv' %}
-unsetenv {{ cmd.name }}
-{% endif %}
-{% else %}
-{# We are using the usual separator #}
-{% if command_name == 'PrependPath' %}
-prepend-path {{ cmd.name }} "{{ cmd.value }}"
-{% elif command_name == 'AppendPath' %}
-append-path {{ cmd.name }} "{{ cmd.value }}"
-{% elif command_name == 'RemovePath' %}
-remove-path {{ cmd.name }} "{{ cmd.value }}"
-{% elif command_name == 'SetEnv' %}
setenv {{ cmd.name }} "{{ cmd.value }}"
{% elif command_name == 'UnsetEnv' %}
unsetenv {{ cmd.name }}
{% endif %}
{# #}
-{% endif %}
{% endfor %}
{% endblock %}