summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorZack Galbreath <zack.galbreath@kitware.com>2018-04-10 11:07:09 -0400
committerTodd Gamblin <tgamblin@llnl.gov>2018-05-15 05:43:07 -0700
commite4e8c72fa1f713062f59304764c36f39f761480e (patch)
tree269d78035e05523958b0193eab10fed80ad2d3e6 /lib
parentde01d70ae4746432270138881e3f8e573708c554 (diff)
downloadspack-e4e8c72fa1f713062f59304764c36f39f761480e.tar.gz
spack-e4e8c72fa1f713062f59304764c36f39f761480e.tar.bz2
spack-e4e8c72fa1f713062f59304764c36f39f761480e.tar.xz
spack-e4e8c72fa1f713062f59304764c36f39f761480e.zip
Initialize report generator before parsing specs
This will allow us to generate reports for concretization errors
Diffstat (limited to 'lib')
-rw-r--r--lib/spack/spack/cmd/install.py10
-rw-r--r--lib/spack/spack/report.py7
2 files changed, 10 insertions, 7 deletions
diff --git a/lib/spack/spack/cmd/install.py b/lib/spack/spack/cmd/install.py
index 99572a1ff2..12c6551716 100644
--- a/lib/spack/spack/cmd/install.py
+++ b/lib/spack/spack/cmd/install.py
@@ -191,6 +191,10 @@ def install(parser, args, **kwargs):
tty.warn("Deprecated option: --run-tests: use --test=all instead")
# 1. Abstract specs from cli
+ reporter = spack.report.collect_info(args.log_format)
+ if args.log_file:
+ reporter.filename = args.log_file
+
specs = spack.cmd.parse_specs(args.package)
if args.test == 'all' or args.run_tests:
spack.package_testing.test_all()
@@ -216,8 +220,10 @@ 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 not args.log_file:
+ reporter.filename = default_log_file(specs[0])
+ reporter.specs = specs
+ with reporter:
if args.overwrite:
# If we asked to overwrite an existing spec we must ensure that:
# 1. We have only one spec
diff --git a/lib/spack/spack/report.py b/lib/spack/spack/report.py
index 5c4db754c6..132a59ecba 100644
--- a/lib/spack/spack/report.py
+++ b/lib/spack/spack/report.py
@@ -249,20 +249,17 @@ class collect_info(object):
Raises:
ValueError: when ``format_name`` is not in ``valid_formats``
"""
- def __init__(self, specs, format_name, filename):
- self.specs = specs
+ def __init__(self, format_name):
self.format_name = format_name
# Check that the format is valid
if format_name not in itertools.chain(valid_formats, [None]):
raise ValueError('invalid report type: {0}'.format(format_name))
- self.filename = filename
- self.collector = InfoCollector(specs) if self.format_name else None
-
def __enter__(self):
if self.format_name:
# Start the collector and patch PackageBase.do_install
+ self.collector = InfoCollector(self.specs)
self.collector.__enter__()
def __exit__(self, exc_type, exc_val, exc_tb):