diff options
Diffstat (limited to 'lib/spack/spack/cmd/activate.py')
-rw-r--r-- | lib/spack/spack/cmd/activate.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/spack/spack/cmd/activate.py b/lib/spack/spack/cmd/activate.py index ae72ec7db2..5105cc8e46 100644 --- a/lib/spack/spack/cmd/activate.py +++ b/lib/spack/spack/cmd/activate.py @@ -26,6 +26,7 @@ import argparse import llnl.util.tty as tty import spack import spack.cmd +from spack.directory_layout import YamlViewExtensionsLayout description = "activate a package extension" section = "extensions" @@ -37,6 +38,9 @@ def setup_parser(subparser): '-f', '--force', action='store_true', help="activate without first activating dependencies") subparser.add_argument( + '-v', '--view', metavar='VIEW', type=str, + help="the view to operate on") + subparser.add_argument( 'spec', nargs=argparse.REMAINDER, help="spec of package extension to activate") @@ -50,7 +54,11 @@ def activate(parser, args): if not spec.package.is_extension: tty.die("%s is not an extension." % spec.name) - if spec.package.is_activated(): + layout = spack.store.extensions + if args.view is not None: + layout = YamlViewExtensionsLayout(args.view, spack.store.layout) + + if spec.package.is_activated(extensions_layout=layout): tty.die("Package %s is already activated." % specs[0].short_spec) - spec.package.do_activate() + spec.package.do_activate(extensions_layout=layout) |