From 82744afe585f7a2ef709fe302486f8d39e323e4f Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Mon, 29 Dec 2014 15:10:31 +0200 Subject: [PATCH] Allow auto-installation of platforms when prompts are disabled // Resolve #43 --- HISTORY.rst | 3 ++- platformio/commands/run.py | 8 +++++--- platformio/commands/show.py | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index 9bd66af6..463e45db 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -15,7 +15,8 @@ Release History *MCUs* (`issue #35 `_) * Automatic detection of port on `platformio serialports monitor `_ (`issue #37 `_) -* Fixed urllib3's *SSL* warning under Python <= 2.7.2 (`issue #39 `_) +* Allowed auto-installation of platforms when prompts are disabled (`issue #43 `_) +* Fixed urllib3's *SSL* warning under Python <= 2.7.2 (`issue #39 `_) * Fixed bug with *Arduino USB* boards (`issue #40 `_) 0.9.2 (2014-12-10) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index c45f61d6..2458b3bb 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -68,10 +68,12 @@ def process_environment(ctx, name, options, targets, upload_port): telemetry.on_run_environment(options, envtargets) - if (app.get_setting("enable_prompts") and - platform not in PlatformFactory.get_platforms(installed=True) and + installed_platforms = PlatformFactory.get_platforms( + installed=True).keys() + if (platform not in installed_platforms and ( + not app.get_setting("enable_prompts") or click.confirm("The platform '%s' has not been installed yet. " - "Would you like to install it now?" % platform)): + "Would you like to install it now?" % platform))): ctx.invoke(cmd_install, platforms=[platform]) p = PlatformFactory.newPlatform(platform) diff --git a/platformio/commands/show.py b/platformio/commands/show.py index de8769bb..989b9aaf 100644 --- a/platformio/commands/show.py +++ b/platformio/commands/show.py @@ -21,7 +21,7 @@ def cli(ctx, platform): installed=True).keys() if platform not in installed_platforms: - if (app.get_setting("enable_prompts") and + if (not app.get_setting("enable_prompts") or click.confirm("The platform '%s' has not been installed yet. " "Would you like to install it now?" % platform)): ctx.invoke(cmd_install, platforms=[platform])