diff options
Diffstat (limited to 'share/spack/setup-env.sh')
-rwxr-xr-x | share/spack/setup-env.sh | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/share/spack/setup-env.sh b/share/spack/setup-env.sh index b90846d28f..586a5b836b 100755 --- a/share/spack/setup-env.sh +++ b/share/spack/setup-env.sh @@ -6,7 +6,7 @@ # Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-647188 # -# For details, see https://scalability-llnl.github.io/spack +# For details, see https://github.com/llnl/spack # Please also see the LICENSE file for our notice and the LGPL. # # This program is free software; you can redistribute it and/or modify @@ -55,7 +55,11 @@ # avoids the need to come up with a user-friendly naming scheme for # spack dotfiles. ######################################################################## + function spack { + # save raw arguments into an array before butchering them + args=( "$@" ) + # accumulate initial flags for main spack command _sp_flags="" while [[ "$1" =~ ^- ]]; do @@ -116,7 +120,7 @@ function spack { esac ;; *) - command spack $_sp_flags $_sp_subcommand $_sp_spec + command spack "${args[@]}" ;; esac } @@ -167,8 +171,8 @@ fi # _sp_share_dir=$(cd "$(dirname $_sp_source_file)" && pwd) _sp_prefix=$(cd "$(dirname $(dirname $_sp_share_dir))" && pwd) +_spack_pathadd PATH "${_sp_prefix%/}/bin" -# TODO: fix SYS_TYPE to something non-LLNL-specific -_spack_pathadd DK_NODE "$_sp_share_dir/dotkit/$SYS_TYPE" -_spack_pathadd MODULEPATH "$_sp_share_dir/modules/$SYS_TYPE" -_spack_pathadd PATH "$_sp_prefix/bin" +_sp_sys_type=$(spack-python -c 'print(spack.architecture.sys_type())') +_spack_pathadd DK_NODE "${_sp_share_dir%/}/dotkit/$_sp_sys_type" +_spack_pathadd MODULEPATH "${_sp_share_dir%/}/modules/$_sp_sys_type" |