env: add --env
argument to spack location
This commit is contained in:
parent
47e60d5ef8
commit
180d804615
@ -36,7 +36,6 @@
|
|||||||
'concretize',
|
'concretize',
|
||||||
'list',
|
'list',
|
||||||
'loads',
|
'loads',
|
||||||
'location',
|
|
||||||
'relocate',
|
'relocate',
|
||||||
'stage',
|
'stage',
|
||||||
'install',
|
'install',
|
||||||
@ -263,15 +262,6 @@ def environment_stage(args):
|
|||||||
dep.package.do_stage()
|
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
|
@contextmanager
|
||||||
def redirect_stdout(ofname):
|
def redirect_stdout(ofname):
|
||||||
"""Redirects STDOUT to (by default) a file within the environment;
|
"""Redirects STDOUT to (by default) a file within the environment;
|
||||||
|
@ -5,11 +5,13 @@
|
|||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
|
import os
|
||||||
import argparse
|
import argparse
|
||||||
import llnl.util.tty as tty
|
import llnl.util.tty as tty
|
||||||
|
|
||||||
import spack.paths
|
|
||||||
import spack.cmd
|
import spack.cmd
|
||||||
|
import spack.environment
|
||||||
|
import spack.paths
|
||||||
import spack.repo
|
import spack.repo
|
||||||
|
|
||||||
description = "print out locations of various directories used by Spack"
|
description = "print out locations of various directories used by Spack"
|
||||||
@ -47,6 +49,9 @@ def setup_parser(subparser):
|
|||||||
'-b', '--build-dir', action='store_true',
|
'-b', '--build-dir', action='store_true',
|
||||||
help="checked out or expanded source directory for a spec "
|
help="checked out or expanded source directory for a spec "
|
||||||
"(requires it to be staged first)")
|
"(requires it to be staged first)")
|
||||||
|
directories.add_argument(
|
||||||
|
'-e', '--env', action='store',
|
||||||
|
help="location of an environment managed by spack")
|
||||||
|
|
||||||
subparser.add_argument(
|
subparser.add_argument(
|
||||||
'spec', nargs=argparse.REMAINDER,
|
'spec', nargs=argparse.REMAINDER,
|
||||||
@ -60,6 +65,12 @@ def location(parser, args):
|
|||||||
elif args.spack_root:
|
elif args.spack_root:
|
||||||
print(spack.paths.prefix)
|
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:
|
elif args.packages:
|
||||||
print(spack.repo.path.first_repo().root)
|
print(spack.repo.path.first_repo().root)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user