summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd Gamblin <tgamblin@llnl.gov>2018-10-28 12:07:46 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2018-11-09 00:31:24 -0800
commit7136274f4bf11ab1b8c332d459946fc8ac8c277a (patch)
tree797e37a0b789455a577557dca270bd98754f572f /lib
parente62506571fdb2ba9e095bb34653640e01e58f9c6 (diff)
downloadspack-7136274f4bf11ab1b8c332d459946fc8ac8c277a.tar.gz
spack-7136274f4bf11ab1b8c332d459946fc8ac8c277a.tar.bz2
spack-7136274f4bf11ab1b8c332d459946fc8ac8c277a.tar.xz
spack-7136274f4bf11ab1b8c332d459946fc8ac8c277a.zip
env: move `spack env stage` into `spack stage` command
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/env.py18
-rw-r--r--lib/spack/spack/cmd/stage.py11
-rw-r--r--lib/spack/spack/cmd/uninstall.py6
-rw-r--r--lib/spack/spack/test/cmd/env.py7
4 files changed, 15 insertions, 27 deletions
diff --git a/lib/spack/spack/cmd/env.py b/lib/spack/spack/cmd/env.py
index b1b042de2e..776f6f0544 100644
--- a/lib/spack/spack/cmd/env.py
+++ b/lib/spack/spack/cmd/env.py
@@ -34,7 +34,6 @@ subcommands = [
['list', 'ls'],
['status', 'st'],
'loads',
- 'stage',
'uninstall',
]
@@ -309,23 +308,6 @@ def env_status(args):
hashlen=None if args.very_long else 7,
install_status=True)
-
-#
-# env stage
-#
-def env_stage_setup_parser(subparser):
- """download all source files for all packages in an environment"""
- subparser.add_argument(
- 'env', nargs='?', help='name of env to generate loads file for')
-
-
-def env_stage(args):
- env = ev.get_env(args, 'env stage')
- for spec in env.specs_by_hash.values():
- for dep in spec.traverse():
- dep.package.do_stage()
-
-
#
# env loads
#
diff --git a/lib/spack/spack/cmd/stage.py b/lib/spack/spack/cmd/stage.py
index b44331cadc..68f2486b0d 100644
--- a/lib/spack/spack/cmd/stage.py
+++ b/lib/spack/spack/cmd/stage.py
@@ -7,6 +7,7 @@ import argparse
import llnl.util.tty as tty
+import spack.environment as ev
import spack.repo
import spack.cmd
import spack.cmd.common.arguments as arguments
@@ -28,7 +29,15 @@ def setup_parser(subparser):
def stage(parser, args):
if not args.specs:
- tty.die("stage requires at least one package argument")
+ env = ev.get_env(args, 'stage', required=False)
+ if env:
+ tty.msg("Staging specs from environment %s" % env.name)
+ for spec in env.specs_by_hash.values():
+ for dep in spec.traverse():
+ dep.package.do_stage()
+ return
+ else:
+ tty.die("`spack stage` requires a spec or an active environment")
if args.no_checksum:
spack.config.set('config:checksum', False, scope='command_line')
diff --git a/lib/spack/spack/cmd/uninstall.py b/lib/spack/spack/cmd/uninstall.py
index 574bd64b44..8fea7c0ac2 100644
--- a/lib/spack/spack/cmd/uninstall.py
+++ b/lib/spack/spack/cmd/uninstall.py
@@ -45,10 +45,9 @@ def setup_parser(subparser):
subparser.add_argument(
'-a', '--all', action='store_true', dest='all',
help="USE CAREFULLY. remove ALL installed packages that match each "
- "supplied spec. i.e., if you say uninstall `libelf`,"
+ "supplied spec. i.e., if you `uninstall --all libelf`,"
" ALL versions of `libelf` are uninstalled. if no spec is "
- "supplied all installed software will be uninstalled. this "
- "is both useful and dangerous, like rm -r")
+ "supplied all installed software will be uninstalled.")
subparser.add_argument(
'packages',
@@ -175,7 +174,6 @@ def get_uninstall_list(args, specs):
def uninstall_specs(args, specs):
-
uninstall_list = get_uninstall_list(args, specs)
if not uninstall_list:
diff --git a/lib/spack/spack/test/cmd/env.py b/lib/spack/spack/test/cmd/env.py
index 2712c4e59d..b49bcbcb9b 100644
--- a/lib/spack/spack/test/cmd/env.py
+++ b/lib/spack/spack/test/cmd/env.py
@@ -26,6 +26,7 @@ install = SpackCommand('install')
add = SpackCommand('add')
remove = SpackCommand('remove')
concretize = SpackCommand('concretize')
+stage = SpackCommand('stage')
def test_add():
@@ -510,13 +511,13 @@ def test_env_loads(install_mockery, mock_fetch):
@pytest.mark.disable_clean_stage_check
-def test_env_stage(mock_stage, mock_fetch, install_mockery):
+def test_stage(mock_stage, mock_fetch, install_mockery):
env('create', 'test')
with ev.read('test'):
add('mpileaks')
add('zmpi')
concretize()
- env('stage', 'test')
+ stage()
root = str(mock_stage)
@@ -541,8 +542,6 @@ def test_env_commands_die_with_no_env_arg():
with pytest.raises(spack.main.SpackCommandError):
env('loads')
with pytest.raises(spack.main.SpackCommandError):
- env('stage')
- with pytest.raises(spack.main.SpackCommandError):
env('uninstall')
# This should NOT raise an error with no environment