diff options
author | Adam J. Stewart <ajstewart426@gmail.com> | 2021-07-08 10:07:26 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-08 17:07:26 +0200 |
commit | 0c5402ea5cf1e28c392aa455ca432040de9a830a (patch) | |
tree | 7d5867c78605d9223452e88047fc48c9a12bb9e1 /share/spack/setup-env.fish | |
parent | a22686279c6e45729c0ce6dc4aee0df2d280b513 (diff) | |
download | spack-0c5402ea5cf1e28c392aa455ca432040de9a830a.tar.gz spack-0c5402ea5cf1e28c392aa455ca432040de9a830a.tar.bz2 spack-0c5402ea5cf1e28c392aa455ca432040de9a830a.tar.xz spack-0c5402ea5cf1e28c392aa455ca432040de9a830a.zip |
setup-env: allow users to skip slow parts (#24545)
Diffstat (limited to 'share/spack/setup-env.fish')
-rwxr-xr-x | share/spack/setup-env.fish | 92 |
1 files changed, 47 insertions, 45 deletions
diff --git a/share/spack/setup-env.fish b/share/spack/setup-env.fish index 239fb8709f..5205cff206 100755 --- a/share/spack/setup-env.fish +++ b/share/spack/setup-env.fish @@ -699,71 +699,73 @@ set -xg _sp_shell "fish" -# -# Check whether we need environment-variables (module) <= `use` is not available -# -set -l need_module "no" -if test -z "$SPACK_SKIP_MODULES"; and not functions -q use; and not functions -q module - set need_module "yes" -end +if test -z "$SPACK_SKIP_MODULES" + # + # Check whether we need environment-variables (module) <= `use` is not available + # + set -l need_module "no" + if not functions -q use; and not functions -q module + set need_module "yes" + end -# -# Make environment-modules available to shell -# -function sp_apply_shell_vars -d "applies expressions of the type `a='b'` as `set a b`" + # + # Make environment-modules available to shell + # + function sp_apply_shell_vars -d "applies expressions of the type `a='b'` as `set a b`" - # convert `a='b' to array variable `a b` - set -l expr_token (string trim -c "'" (string split "=" $argv)) + # convert `a='b' to array variable `a b` + set -l expr_token (string trim -c "'" (string split "=" $argv)) - # run set command to takes, converting lists of type `a:b:c` to array - # variables `a b c` by splitting around the `:` character - set -xg $expr_token[1] (string split ":" $expr_token[2]) -end + # run set command to takes, converting lists of type `a:b:c` to array + # variables `a b c` by splitting around the `:` character + set -xg $expr_token[1] (string split ":" $expr_token[2]) + end -if test "$need_module" = "yes" - set -l sp_shell_vars (command spack --print-shell-vars sh,modules) + if test "$need_module" = "yes" + set -l sp_shell_vars (command spack --print-shell-vars sh,modules) - for sp_var_expr in $sp_shell_vars - sp_apply_shell_vars $sp_var_expr - end + for sp_var_expr in $sp_shell_vars + sp_apply_shell_vars $sp_var_expr + end - # _sp_module_prefix is set by spack --print-sh-vars - if test "$_sp_module_prefix" != "not_installed" - set -xg MODULE_PREFIX $_sp_module_prefix - spack_pathadd PATH "$MODULE_PREFIX/bin" - end + # _sp_module_prefix is set by spack --print-sh-vars + if test "$_sp_module_prefix" != "not_installed" + set -xg MODULE_PREFIX $_sp_module_prefix + spack_pathadd PATH "$MODULE_PREFIX/bin" + end -else + else - set -l sp_shell_vars (command spack --print-shell-vars sh) + set -l sp_shell_vars (command spack --print-shell-vars sh) - for sp_var_expr in $sp_shell_vars - sp_apply_shell_vars $sp_var_expr - end + for sp_var_expr in $sp_shell_vars + sp_apply_shell_vars $sp_var_expr + end -end + end -if test "$need_module" = "yes" - function module -d "wrapper for the `module` command to point at Spack's modules instance" --inherit-variable MODULE_PREFIX - eval $MODULE_PREFIX/bin/modulecmd $SPACK_SHELL $argv + if test "$need_module" = "yes" + function module -d "wrapper for the `module` command to point at Spack's modules instance" --inherit-variable MODULE_PREFIX + eval $MODULE_PREFIX/bin/modulecmd $SPACK_SHELL $argv + end end -end -# -# set module system roots -# + # + # set module system roots + # -# Search of MODULESPATHS by trying all possible compatible system types as -# module roots. -if test -z "$MODULEPATH" - set -gx MODULEPATH + # Search of MODULESPATHS by trying all possible compatible system types as + # module roots. + if test -z "$MODULEPATH" + set -gx MODULEPATH + end + sp_multi_pathadd MODULEPATH $_sp_tcl_roots end -sp_multi_pathadd MODULEPATH $_sp_tcl_roots |