Added install option to read spec from file (#4611)
This commit is contained in:
parent
7b0d295a4c
commit
b1861b29ef
@ -77,6 +77,9 @@ def setup_parser(subparser):
|
|||||||
subparser.add_argument(
|
subparser.add_argument(
|
||||||
'--fake', action='store_true', dest='fake',
|
'--fake', action='store_true', dest='fake',
|
||||||
help="fake install. just remove prefix and create a fake file")
|
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()
|
cd_group = subparser.add_mutually_exclusive_group()
|
||||||
arguments.add_common_arguments(cd_group, ['clean', 'dirty'])
|
arguments.add_common_arguments(cd_group, ['clean', 'dirty'])
|
||||||
@ -320,6 +323,12 @@ def install(parser, args, **kwargs):
|
|||||||
})
|
})
|
||||||
|
|
||||||
# Spec from cli
|
# Spec from cli
|
||||||
|
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)
|
specs = spack.cmd.parse_specs(args.package, concretize=True)
|
||||||
if len(specs) == 0:
|
if len(specs) == 0:
|
||||||
tty.error('The `spack install` command requires a spec to install.')
|
tty.error('The `spack install` command requires a spec to install.')
|
||||||
|
Loading…
Reference in New Issue
Block a user