Allow --overwrite and --log-format to be used together

Restructure the logic of the spack install command to allow these two
command-line arguments to be used at the same time.
This commit is contained in:
Zack Galbreath 2018-04-10 11:00:14 -04:00 committed by Todd Gamblin
parent 6c5dbdd9cd
commit de01d70ae4

View File

@ -216,6 +216,8 @@ def install(parser, args, **kwargs):
if len(specs) == 0:
tty.die('The `spack install` command requires a spec to install.')
filename = args.log_file or default_log_file(specs[0])
with spack.report.collect_info(specs, args.log_format, filename):
if args.overwrite:
# If we asked to overwrite an existing spec we must ensure that:
# 1. We have only one spec
@ -249,8 +251,5 @@ def install(parser, args, **kwargs):
install_spec(args, kwargs, specs[0])
else:
filename = args.log_file or default_log_file(specs[0])
with spack.report.collect_info(specs, args.log_format, filename):
for spec in specs:
install_spec(args, kwargs, spec)