setup-env: allow users to skip slow parts (#24545)

This commit is contained in:
Adam J. Stewart 2021-07-08 10:07:26 -05:00 committed by GitHub
parent a22686279c
commit 0c5402ea5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 102 additions and 98 deletions

View File

@ -699,11 +699,12 @@ set -xg _sp_shell "fish"
if test -z "$SPACK_SKIP_MODULES"
#
# 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
if not functions -q use; and not functions -q module
set need_module "yes"
end
@ -764,6 +765,7 @@ if test -z "$MODULEPATH"
set -gx MODULEPATH
end
sp_multi_pathadd MODULEPATH $_sp_tcl_roots
end

View File

@ -306,11 +306,6 @@ _spack_fn_exists() {
LANG= type $1 2>&1 | grep -q 'function'
}
need_module="no"
if [ -z "${SPACK_SKIP_MODULES+x}" ] && ! _spack_fn_exists use && ! _spack_fn_exists module; then
need_module="yes"
fi;
# Define the spack shell function with some informative no-ops, so when users
# run `which spack`, they see the path to spack and where the function is from.
eval "spack() {
@ -334,6 +329,12 @@ for cmd in "${SPACK_PYTHON:-}" python3 python python2; do
fi
done
if [ -z "${SPACK_SKIP_MODULES+x}" ]; then
need_module="no"
if ! _spack_fn_exists use && ! _spack_fn_exists module; then
need_module="yes"
fi;
#
# make available environment-modules
#
@ -376,6 +377,7 @@ _sp_multi_pathadd() {
done
}
_sp_multi_pathadd MODULEPATH "$_sp_tcl_roots"
fi
# Add programmable tab completion for Bash
#