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.
This commit is contained in:
committed by
GitHub
parent
d0d5526110
commit
906151075d
@@ -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 %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user