summaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorDavid Beckingsale <davidbeckingsale@gmail.com>2014-07-31 13:42:34 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2014-08-04 07:53:40 -0700
commit94c5c9667c786e05a635787e803d2cf7e22de73a (patch)
treef086e708ac5f9f0006eea41f9d7685f9530b033d /share
parentd0b179962b87470edbaf4e05e41e748bebe27a3d (diff)
downloadspack-94c5c9667c786e05a635787e803d2cf7e22de73a.tar.gz
spack-94c5c9667c786e05a635787e803d2cf7e22de73a.tar.bz2
spack-94c5c9667c786e05a635787e803d2cf7e22de73a.tar.xz
spack-94c5c9667c786e05a635787e803d2cf7e22de73a.zip
Added inital module support
Diffstat (limited to 'share')
-rwxr-xr-xshare/spack/setup-env.bash49
1 files changed, 33 insertions, 16 deletions
diff --git a/share/spack/setup-env.bash b/share/spack/setup-env.bash
index e22a259167..c23a5acab4 100755
--- a/share/spack/setup-env.bash
+++ b/share/spack/setup-env.bash
@@ -65,8 +65,38 @@ function spack {
# Filter out use and unuse. For any other commands, just run the
# command.
case $_spack_subcommand in
- "use") ;;
- "unuse") ;;
+ "use"|"unuse")
+ # Shift any other args for use off before parsing spec.
+ _spack_use_args=""
+ if [[ "$1" =~ ^- ]]; then
+ _spack_use_args="$1"; shift
+ _spack_spec="$@"
+ fi
+
+ # Here the user has run use or unuse with a spec. Find a matching
+ # spec with a dotkit using spack dotkit, then use or unuse the
+ # result. If spack dotkit comes back with an error, do nothing.
+ if _spack_full_spec=$(command spack dotkit $_spack_spec); then
+ $_spack_subcommand $_spack_use_args $_spack_full_spec
+ fi
+ return
+ ;;
+ "load"|"unload")
+ # Shift any other args for module off before parsing spec.
+ _spack_module_args=""
+ if [[ "$1" =~ ^- ]]; then
+ _spack_module_args="$1"; shift
+ _spack_spec="$@"
+ fi
+
+ # Here the user has run use or unuse with a spec. Find a matching
+ # spec with a dotkit using spack dotkit, then use or unuse the
+ # result. If spack dotkit comes back with an error, do nothing.
+ if _spack_full_spec=$(command spack tclmodule $_spack_spec); then
+ $_spack_subcommand $_spack_module_args $_spack_full_spec
+ fi
+ return
+ ;;
*)
command spack $_spack_subcommand "$@"
return
@@ -79,19 +109,6 @@ function spack {
return
fi
- # Shift any other args for use off before parsing spec.
- _spack_use_args=""
- if [[ "$1" =~ ^- ]]; then
- _spack_use_args="$1"; shift
- _spack_spec="$@"
- fi
-
- # Here the user has run use or unuse with a spec. Find a matching
- # spec with a dotkit using spack dotkit, then use or unuse the
- # result. If spack dotkit comes back with an error, do nothing.
- if _spack_full_spec=$(command spack dotkit $_spack_spec); then
- $_spack_subcommand $_spack_use_args $_spack_full_spec
- fi
}
########################################################################
@@ -128,5 +145,5 @@ _spack_share_dir="$(dirname ${BASH_SOURCE[0]})"
_spack_prefix="$(dirname $(dirname $_spack_share_dir))"
_spack_pathadd DK_NODE "$_spack_share_dir/dotkit"
+_spack_pathadd MODULEPATH "$_spack_share_dir/modules"
_spack_pathadd PATH "$_spack_prefix/bin"
-