diff options
-rw-r--r-- | lib/spack/spack/cmd/env.py | 10 | ||||
-rw-r--r-- | lib/spack/spack/cmd/location.py | 13 |
2 files changed, 12 insertions, 11 deletions
diff --git a/lib/spack/spack/cmd/env.py b/lib/spack/spack/cmd/env.py index ad7750671e..da089c35c4 100644 --- a/lib/spack/spack/cmd/env.py +++ b/lib/spack/spack/cmd/env.py @@ -36,7 +36,6 @@ subcommands = [ 'concretize', 'list', 'loads', - 'location', 'relocate', 'stage', 'install', @@ -263,15 +262,6 @@ def environment_stage(args): dep.package.do_stage() -def setup_location_parser(subparser): - """print the root directory of the environment""" - - -def environment_location(args): - environment = ev.read(args.environment) - print(environment.path) - - @contextmanager def redirect_stdout(ofname): """Redirects STDOUT to (by default) a file within the environment; diff --git a/lib/spack/spack/cmd/location.py b/lib/spack/spack/cmd/location.py index 396128f089..c97075441d 100644 --- a/lib/spack/spack/cmd/location.py +++ b/lib/spack/spack/cmd/location.py @@ -5,11 +5,13 @@ from __future__ import print_function +import os import argparse import llnl.util.tty as tty -import spack.paths import spack.cmd +import spack.environment +import spack.paths import spack.repo description = "print out locations of various directories used by Spack" @@ -47,6 +49,9 @@ def setup_parser(subparser): '-b', '--build-dir', action='store_true', help="checked out or expanded source directory for a spec " "(requires it to be staged first)") + directories.add_argument( + '-e', '--env', action='store', + help="location of an environment managed by spack") subparser.add_argument( 'spec', nargs=argparse.REMAINDER, @@ -60,6 +65,12 @@ def location(parser, args): elif args.spack_root: print(spack.paths.prefix) + elif args.env: + path = spack.environment.root(args.env) + if not os.path.isdir(path): + tty.die("no such environment: '%s'" % args.env) + print(path) + elif args.packages: print(spack.repo.path.first_repo().root) |