diff --git a/HISTORY.rst b/HISTORY.rst index 8ff024cb..f5783f63 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,16 @@ Release History =============== +0.9.2 (2014-12-10) +------------------ + +* Replaced "dark blue" by "cyan" colour for the texts (`issue #33 `_) +* Added new setting `enable_prompts `_ + and allowed to disable all *PlatformIO* prompts (useful for cloud compilers) + (`issue #34 `_) +* Fixed compilation bug on *Windows* with installed *MSVC* (`issue #18 `_) + + 0.9.1 (2014-12-05) ------------------ diff --git a/docs/installation.rst b/docs/installation.rst index e0df7b68..287188da 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -25,6 +25,11 @@ application: `Command Prompt `_ (``cmd.exe``) application. +.. warning:: + If you are going to use *PlatformIO* for "*Cloud Compiling*", please + don't forget to turn off :ref:`enable_prompts ` setting. It + will allow you to avoid blocking when call ``platformio`` like subprocess. + Please *choose one of* the following: Super-Quick (Mac / Linux) diff --git a/platformio/__init__.py b/platformio/__init__.py index e2ae4fe1..aa63e746 100644 --- a/platformio/__init__.py +++ b/platformio/__init__.py @@ -1,7 +1,7 @@ # Copyright (C) Ivan Kravets # See LICENSE for details. -VERSION = (0, 9, 1) +VERSION = (0, 9, 2) __version__ = ".".join([str(s) for s in VERSION]) __title__ = "platformio" diff --git a/platformio/app.py b/platformio/app.py index 3f24617a..9101796b 100644 --- a/platformio/app.py +++ b/platformio/app.py @@ -33,6 +33,15 @@ DEFAULT_SETTINGS = { "description": ("Shares commands, platforms and libraries usage" " to help us make PlatformIO better (Yes/No)"), "value": True + }, + "enable_prompts": { + "description": ( + "Can PlatformIO communicate with you via prompts: " + "propose to install platforms which aren't installed yet, " + "paginate over library search results and etc.)? ATTENTION!!! " + "If you call PlatformIO like subprocess, " + "please disable prompts to avoid blocking (Yes/No)"), + "value": True } } diff --git a/platformio/builder/main.py b/platformio/builder/main.py index 5fcfbed3..d2cac107 100644 --- a/platformio/builder/main.py +++ b/platformio/builder/main.py @@ -50,7 +50,8 @@ commonvars.AddVariables( ) DefaultEnvironment( - tools=["default", "platformio"], + # Temporary fix for the issue #18 + tools=["default", "gcc", "g++", "ar", "gnulink", "platformio"], toolpath=[join("$PIOBUILDER_DIR", "tools")], variables=commonvars, diff --git a/platformio/commands/init.py b/platformio/commands/init.py index 9d9abcf3..986d784c 100644 --- a/platformio/commands/init.py +++ b/platformio/commands/init.py @@ -7,6 +7,7 @@ from shutil import copyfile import click +from platformio import app from platformio.exception import ProjectInitialized from platformio.util import get_source_dir @@ -25,7 +26,7 @@ def cli(project_dir): if project_dir == getcwd(): click.secho("The current working directory", fg="yellow", nl=False) - click.secho(" %s " % project_dir, fg="blue", nl=False) + click.secho(" %s " % project_dir, fg="cyan", nl=False) click.secho( "will be used for the new project.\n" "You can specify another project directory via\n" @@ -34,7 +35,7 @@ def cli(project_dir): ) click.echo("The next files/directories will be created in %s" % - click.style(project_dir, fg="blue")) + click.style(project_dir, fg="cyan")) click.echo("%s - Project Configuration File" % click.style("platformio.ini", fg="cyan")) click.echo("%s - a source directory. Put your source code here" % @@ -42,7 +43,8 @@ def cli(project_dir): click.echo("%s - a directory for the project specific libraries" % click.style("lib", fg="cyan")) - if click.confirm("Do you want to continue?"): + if (not app.get_setting("enable_prompts") or + click.confirm("Do you want to continue?")): for d in (src_dir, lib_dir): if not isdir(d): makedirs(d) diff --git a/platformio/commands/lib.py b/platformio/commands/lib.py index c2350bb4..67f61827 100644 --- a/platformio/commands/lib.py +++ b/platformio/commands/lib.py @@ -3,6 +3,7 @@ import click +from platformio import app from platformio.exception import (LibAlreadyInstalledError, LibInstallDependencyError) from platformio.libmanager import LibraryManager @@ -69,7 +70,8 @@ def lib_search(query, **filters): if int(result['page'])*int(result['perpage']) >= int(result['total']): break - if click.confirm("Show next libraries?"): + if (app.get_setting("enable_prompts") and + click.confirm("Show next libraries?")): result = get_api_result( "/lib/search", dict(query=query, page=str(int(result['page']) + 1)) diff --git a/platformio/commands/run.py b/platformio/commands/run.py index f16e3f96..c45f61d6 100644 --- a/platformio/commands/run.py +++ b/platformio/commands/run.py @@ -3,7 +3,7 @@ import click -from platformio import exception, telemetry +from platformio import app, exception, telemetry from platformio.commands.install import cli as cmd_install from platformio.platforms.base import PlatformFactory from platformio.util import get_project_config @@ -68,7 +68,8 @@ def process_environment(ctx, name, options, targets, upload_port): telemetry.on_run_environment(options, envtargets) - if (platform not in PlatformFactory.get_platforms(installed=True) and + if (app.get_setting("enable_prompts") and + platform not in PlatformFactory.get_platforms(installed=True) and click.confirm("The platform '%s' has not been installed yet. " "Would you like to install it now?" % platform)): ctx.invoke(cmd_install, platforms=[platform]) diff --git a/platformio/commands/show.py b/platformio/commands/show.py index 746daa61..de8769bb 100644 --- a/platformio/commands/show.py +++ b/platformio/commands/show.py @@ -5,6 +5,7 @@ from datetime import datetime import click +from platformio import app from platformio.commands.install import cli as cmd_install from platformio.exception import PlatformNotInstalledYet from platformio.pkgmanager import PackageManager @@ -20,8 +21,9 @@ def cli(ctx, platform): installed=True).keys() if platform not in installed_platforms: - if click.confirm("The platform '%s' has not been installed yet. " - "Would you like to install it now?" % platform): + if (app.get_setting("enable_prompts") and + click.confirm("The platform '%s' has not been installed yet. " + "Would you like to install it now?" % platform)): ctx.invoke(cmd_install, platforms=[platform]) else: raise PlatformNotInstalledYet(platform) diff --git a/platformio/maintenance.py b/platformio/maintenance.py index ca6d5b91..d7d620d5 100644 --- a/platformio/maintenance.py +++ b/platformio/maintenance.py @@ -92,11 +92,11 @@ def after_upgrade(ctx): "- %s us on Twitter to stay up-to-date " "on the latest project news > %s" % (click.style("follow", fg="cyan"), - click.style("https://twitter.com/platformiotool", fg="blue")) + click.style("https://twitter.com/platformiotool", fg="cyan")) ) click.echo("- %s us a star on GitHub > %s" % ( click.style("give", fg="cyan"), - click.style("https://github.com/ivankravets/platformio", fg="blue") + click.style("https://github.com/ivankravets/platformio", fg="cyan") )) click.secho("Thanks a lot!\n", fg="green", blink=True) @@ -138,10 +138,10 @@ def check_platformio_upgrade(): click.secho("There is a new version %s of PlatformIO available.\n" "Please upgrade it via " % latest_version, fg="yellow", nl=False) - click.secho("`platformio upgrade`", fg="cyan", nl=False) + click.secho("platformio upgrade", fg="cyan", nl=False) click.secho(" command.\nChanges: ", fg="yellow", nl=False) click.secho("http://docs.platformio.ikravets.com/en/latest/history.html\n", - fg="blue") + fg="cyan") def check_internal_updates(ctx, what): diff --git a/platformio/telemetry.py b/platformio/telemetry.py index e83bdca8..55d1d276 100644 --- a/platformio/telemetry.py +++ b/platformio/telemetry.py @@ -110,6 +110,9 @@ class MeasurementProtocol(TelemetryBase): self['cd3'] = " ".join(args) def send(self, hittype): + if not app.get_setting("enable_telemetry"): + return + self['t'] = hittype # correct queue time diff --git a/requirements.txt b/requirements.txt index 7a24fbb9..f2fc32dd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ click==3.3 colorama==0.3.2 pyserial==2.7 -requests==2.4.3 +requests==2.5.0 scons==2.3.0