From 9b0bc500fdbaeb7d2c4ce85f6c9b101e30b67ebd Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Sun, 18 Sep 2016 01:11:55 +0300 Subject: [PATCH] Summary about processed environments // Resolve #777 --- HISTORY.rst | 2 ++ platformio/__init__.py | 2 +- platformio/commands/run.py | 35 +++++++++++++++++++++++++++++++---- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 73e959b2..5b787767 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -9,6 +9,8 @@ PlatformIO 3.0 * New! Dynamic variables/templates for `Project Configuration File "platformio.ini" `__ (`issue #705 `_) +* Summary about processed environments + (`issue #777 `_) * Implemented LocalCache system for API and improved a work in off-line mode * Improved Project Generator when custom ``--project-option`` is passed to `platformio init `__ diff --git a/platformio/__init__.py b/platformio/__init__.py index aa5375e8..3757f355 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -14,7 +14,7 @@ import sys -VERSION = (3, 1, "0a4") +VERSION = (3, 1, "0a5") __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/commands/run.py b/platformio/commands/run.py index 676c3924..e8b20147 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -80,7 +80,8 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose, for e in config.get("platformio", "env_default").split(",") ] - results = [] + results = {} + start_time = time() for section in config.sections(): if not section.startswith("env:"): continue @@ -90,7 +91,7 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose, not environment and env_default and envname not in env_default]) if skipenv: - # echo("Skipped %s environment" % style(envname, fg="yellow")) + results[envname] = None continue if results: @@ -104,9 +105,35 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose, ep = EnvironmentProcessor(ctx, envname, options, target, upload_port, silent, verbose) - results.append(ep.process()) + results[envname] = ep.process() - if not all(results): + errored = False + if len(results) > 1: + click.echo() + print_header("[%s]" % click.style("SUMMARY")) + + for envname, status in results.items(): + errored = False + status_str = click.style("SUCCESS", fg="green") + if status is False: + errored = True + status_str = click.style("ERROR", fg="red") + elif status is None: + status_str = click.style("SKIP", fg="yellow") + + click.echo( + "Environment %s:\t[%s]" % (click.style( + envname, fg="cyan"), status_str), + err=status is False) + + print_header( + "[%s] Took %.2f seconds" % ((click.style( + "SUCCESS", fg="green", + bold=True) if not errored else click.style( + "ERROR", fg="red", bold=True)), time() - start_time), + is_error=errored) + + if any([r is False for r in results.values()]): raise exception.ReturnErrorCode() return True