From b1861b29efe929c81aacbf8848ddd7d309c00e18 Mon Sep 17 00:00:00 2001 From: becker33 Date: Tue, 27 Jun 2017 12:27:16 -0700 Subject: Added install option to read spec from file (#4611) --- lib/spack/spack/cmd/install.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/spack/spack/cmd/install.py b/lib/spack/spack/cmd/install.py index ec24ed9c62..9f35837220 100644 --- a/lib/spack/spack/cmd/install.py +++ b/lib/spack/spack/cmd/install.py @@ -77,6 +77,9 @@ the dependencies""" subparser.add_argument( '--fake', action='store_true', dest='fake', help="fake install. just remove prefix and create a fake file") + subparser.add_argument( + '-f', '--file', action='store_true', dest='file', + help="install from file. Read specs to install from .yaml files") cd_group = subparser.add_mutually_exclusive_group() arguments.add_common_arguments(cd_group, ['clean', 'dirty']) @@ -320,7 +323,13 @@ def install(parser, args, **kwargs): }) # Spec from cli - specs = spack.cmd.parse_specs(args.package, concretize=True) + specs = [] + if args.file: + for file in args.package: + with open(file, 'r') as f: + specs.append(spack.spec.Spec.from_yaml(f)) + else: + specs = spack.cmd.parse_specs(args.package, concretize=True) if len(specs) == 0: tty.error('The `spack install` command requires a spec to install.') -- cgit v1.2.3-60-g2f50