2019-12-31 14:36:56 +08:00
|
|
|
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
|
2018-10-08 04:52:23 +08:00
|
|
|
# Spack Project Developers. See the top-level COPYRIGHT file for details.
|
2014-08-17 05:58:15 +08:00
|
|
|
#
|
2018-10-08 04:52:23 +08:00
|
|
|
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
|
|
|
|
|
2014-08-17 05:58:15 +08:00
|
|
|
|
|
|
|
#
|
|
|
|
# This file is part of Spack and sets up the spack environment for
|
2019-10-03 13:15:01 +08:00
|
|
|
# csh and tcsh. This includes environment modules and lmod support, and
|
2014-08-17 05:58:15 +08:00
|
|
|
# it also puts spack in your path. Source it like this:
|
|
|
|
#
|
|
|
|
# setenv SPACK_ROOT /path/to/spack
|
|
|
|
# source $SPACK_ROOT/share/spack/setup-env.csh
|
|
|
|
#
|
2020-07-06 13:35:01 +08:00
|
|
|
|
|
|
|
# prevent infinite recursion when spack shells out (e.g., on cray for modules)
|
|
|
|
if ($?_sp_initializing) then
|
|
|
|
exit 0
|
|
|
|
endif
|
|
|
|
setenv _sp_initializing true
|
|
|
|
|
2014-08-17 05:58:15 +08:00
|
|
|
if ($?SPACK_ROOT) then
|
|
|
|
set _spack_source_file = $SPACK_ROOT/share/spack/setup-env.csh
|
|
|
|
set _spack_share_dir = $SPACK_ROOT/share/spack
|
|
|
|
|
|
|
|
# Command aliases point at separate source files
|
|
|
|
alias spack 'set _sp_args = (\!*); source $_spack_share_dir/csh/spack.csh'
|
2020-05-14 02:02:38 +08:00
|
|
|
alias spacktivate 'spack env activate'
|
2014-08-23 02:00:19 +08:00
|
|
|
alias _spack_pathadd 'set _pa_args = (\!*) && source $_spack_share_dir/csh/pathadd.csh'
|
2014-08-17 05:58:15 +08:00
|
|
|
|
2018-07-17 06:43:44 +08:00
|
|
|
# Set variables needed by this script
|
2018-07-19 00:36:22 +08:00
|
|
|
_spack_pathadd PATH "$SPACK_ROOT/bin"
|
2018-07-17 06:43:44 +08:00
|
|
|
eval `spack --print-shell-vars csh`
|
2017-05-10 23:18:45 +08:00
|
|
|
|
2019-10-03 13:15:01 +08:00
|
|
|
# Set up module search paths in the user environment
|
2019-03-28 04:06:46 +08:00
|
|
|
set tcl_roots = `echo $_sp_tcl_roots:q | sed 's/:/ /g'`
|
2019-09-27 04:51:16 +08:00
|
|
|
set compatible_sys_types = `echo $_sp_compatible_sys_types:q | sed 's/:/ /g'`
|
2019-03-28 04:06:46 +08:00
|
|
|
foreach tcl_root ($tcl_roots:q)
|
2019-09-27 04:51:16 +08:00
|
|
|
foreach systype ($compatible_sys_types:q)
|
|
|
|
_spack_pathadd MODULEPATH "$tcl_root/$systype"
|
|
|
|
end
|
2019-03-28 04:06:46 +08:00
|
|
|
end
|
|
|
|
|
2017-05-10 23:18:45 +08:00
|
|
|
else
|
2018-10-15 06:21:57 +08:00
|
|
|
echo "ERROR: Sourcing spack setup-env.csh requires setting SPACK_ROOT to "
|
|
|
|
echo " the root of your spack installation."
|
2014-08-17 05:58:15 +08:00
|
|
|
endif
|
2020-07-06 13:35:01 +08:00
|
|
|
|
|
|
|
# done: unset sentinel variable as we're no longer initializing
|
|
|
|
unsetenv _sp_initializing
|