summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorbecker33 <becker33@llnl.gov>2017-06-27 12:27:16 -0700
committerTodd Gamblin <tgamblin@llnl.gov>2017-06-27 12:27:16 -0700
commitb1861b29efe929c81aacbf8848ddd7d309c00e18 (patch)
tree8d5baa0e5b0f1b615ea00ae9f3ec087fd4329046 /lib
parent7b0d295a4ce86175503f2713e032e8caaefdb3aa (diff)
downloadspack-b1861b29efe929c81aacbf8848ddd7d309c00e18.tar.gz
spack-b1861b29efe929c81aacbf8848ddd7d309c00e18.tar.bz2
spack-b1861b29efe929c81aacbf8848ddd7d309c00e18.tar.xz
spack-b1861b29efe929c81aacbf8848ddd7d309c00e18.zip
Added install option to read spec from file (#4611)
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/install.py11
1 files changed, 10 insertions, 1 deletions
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.')