diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/spack/spack/cmd/common/__init__.py | 22 | ||||
-rw-r--r-- | lib/spack/spack/cmd/load.py | 4 | ||||
-rw-r--r-- | lib/spack/spack/cmd/unload.py | 4 | ||||
-rw-r--r-- | lib/spack/spack/cmd/unuse.py | 4 | ||||
-rw-r--r-- | lib/spack/spack/cmd/use.py | 4 |
5 files changed, 30 insertions, 8 deletions
diff --git a/lib/spack/spack/cmd/common/__init__.py b/lib/spack/spack/cmd/common/__init__.py index 8922701e9f..bb4e45438e 100644 --- a/lib/spack/spack/cmd/common/__init__.py +++ b/lib/spack/spack/cmd/common/__init__.py @@ -22,3 +22,25 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## + +import spack +from llnl.util import tty + + +def print_module_placeholder_help(): + """ + For use by commands to tell user how to activate shell support. + """ + tty.msg("This command requires spack's shell integration.", "", + "To initialize spack's shell commands, you must run one of", + "the commands below. Choose the right command for your shell.", + "", "For bash and zsh:", + " . %s/setup-env.sh" % spack.share_path, "", + "For csh and tcsh:", " setenv SPACK_ROOT %s" % spack.prefix, + " source %s/setup-env.csh" % spack.share_path, "", + "This exposes a 'spack' shell function, which you can use like", + " $ spack load package-foo", "", + "Running the Spack executable directly (for example, invoking", + "./bin/spack) will bypass the shell function and print this", + "placeholder message, even if you have sourced one of the above", + "shell integration scripts.") diff --git a/lib/spack/spack/cmd/load.py b/lib/spack/spack/cmd/load.py index cb6f8402aa..61c7003855 100644 --- a/lib/spack/spack/cmd/load.py +++ b/lib/spack/spack/cmd/load.py @@ -23,7 +23,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## import argparse -import spack.modules +from spack.cmd.common import print_module_placeholder_help description = "add package to environment using `module load`" section = "environment" @@ -40,4 +40,4 @@ def setup_parser(subparser): def load(parser, args): - spack.modules.print_help() + print_module_placeholder_help() diff --git a/lib/spack/spack/cmd/unload.py b/lib/spack/spack/cmd/unload.py index 3255a4835e..9820ff52d3 100644 --- a/lib/spack/spack/cmd/unload.py +++ b/lib/spack/spack/cmd/unload.py @@ -23,7 +23,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## import argparse -import spack.modules +from spack.cmd.common import print_module_placeholder_help description = "remove package from environment using `module unload`" section = "environment" @@ -39,4 +39,4 @@ def setup_parser(subparser): def unload(parser, args): - spack.modules.print_help() + print_module_placeholder_help() diff --git a/lib/spack/spack/cmd/unuse.py b/lib/spack/spack/cmd/unuse.py index c07b21e0d4..14ca4227d2 100644 --- a/lib/spack/spack/cmd/unuse.py +++ b/lib/spack/spack/cmd/unuse.py @@ -23,7 +23,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## import argparse -import spack.modules +from spack.cmd.common import print_module_placeholder_help description = "remove package from environment using dotkit" section = "environment" @@ -39,4 +39,4 @@ def setup_parser(subparser): def unuse(parser, args): - spack.modules.print_help() + print_module_placeholder_help() diff --git a/lib/spack/spack/cmd/use.py b/lib/spack/spack/cmd/use.py index 11559fc7ff..956f5c6cbc 100644 --- a/lib/spack/spack/cmd/use.py +++ b/lib/spack/spack/cmd/use.py @@ -23,7 +23,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## import argparse -import spack.modules +from spack.cmd.common import print_module_placeholder_help description = "add package to environment using dotkit" section = "environment" @@ -39,4 +39,4 @@ def setup_parser(subparser): def use(parser, args): - spack.modules.print_help() + print_module_placeholder_help() |