summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorXavier Delaruelle <xavier.delaruelle@cea.fr>2023-03-24 20:38:24 +0100
committerGitHub <noreply@github.com>2023-03-24 15:38:24 -0400
commitc4923fe3b3ee28ac47311411a631b228aaefef38 (patch)
tree43f9635d738f2077d236d75f4446870d81d7d4a5 /share
parentae504ce2feeb2126d4ecb4098e01a1df1761b39d (diff)
downloadspack-c4923fe3b3ee28ac47311411a631b228aaefef38.tar.gz
spack-c4923fe3b3ee28ac47311411a631b228aaefef38.tar.bz2
spack-c4923fe3b3ee28ac47311411a631b228aaefef38.tar.xz
spack-c4923fe3b3ee28ac47311411a631b228aaefef38.zip
modules: add support for append_flags/remove_flags (#36402)
Adapt tcl and lmod modulefile templates to generate append-path or remove-path commands in modulefile when respectively append_flags or remove_flags commands are defined in package for run environment. Fixes #10299.
Diffstat (limited to 'share')
-rw-r--r--share/spack/templates/modules/modulefile.lua4
-rw-r--r--share/spack/templates/modules/modulefile.tcl4
2 files changed, 4 insertions, 4 deletions
diff --git a/share/spack/templates/modules/modulefile.lua b/share/spack/templates/modules/modulefile.lua
index 146a8e882d..8a8329ecd1 100644
--- a/share/spack/templates/modules/modulefile.lua
+++ b/share/spack/templates/modules/modulefile.lua
@@ -70,9 +70,9 @@ depends_on("{{ module }}")
{% for command_name, cmd in environment_modifications %}
{% if command_name == 'PrependPath' %}
prepend_path("{{ cmd.name }}", "{{ cmd.value }}", "{{ cmd.separator }}")
-{% elif command_name == 'AppendPath' %}
+{% elif command_name in ('AppendPath', 'AppendFlagsEnv') %}
append_path("{{ cmd.name }}", "{{ cmd.value }}", "{{ cmd.separator }}")
-{% elif command_name == 'RemovePath' %}
+{% elif command_name in ('RemovePath', 'RemoveFlagsEnv') %}
remove_path("{{ cmd.name }}", "{{ cmd.value }}", "{{ cmd.separator }}")
{% elif command_name == 'SetEnv' %}
setenv("{{ cmd.name }}", "{{ cmd.value }}")
diff --git a/share/spack/templates/modules/modulefile.tcl b/share/spack/templates/modules/modulefile.tcl
index be53856ba7..5ea976fbdd 100644
--- a/share/spack/templates/modules/modulefile.tcl
+++ b/share/spack/templates/modules/modulefile.tcl
@@ -43,9 +43,9 @@ conflict {{ name }}
{% for command_name, cmd in environment_modifications %}
{% if command_name == 'PrependPath' %}
prepend-path --delim "{{ cmd.separator }}" {{ cmd.name }} "{{ cmd.value }}"
-{% elif command_name == 'AppendPath' %}
+{% elif command_name in ('AppendPath', 'AppendFlagsEnv') %}
append-path --delim "{{ cmd.separator }}" {{ cmd.name }} "{{ cmd.value }}"
-{% elif command_name == 'RemovePath' %}
+{% elif command_name in ('RemovePath', 'RemoveFlagsEnv') %}
remove-path --delim "{{ cmd.separator }}" {{ cmd.name }} "{{ cmd.value }}"
{% elif command_name == 'SetEnv' %}
setenv {{ cmd.name }} "{{ cmd.value }}"