Ask user to install platform when it hasn't been installed yet

This commit is contained in:
Ivan Kravets
2014-12-03 20:15:52 +02:00
parent 61e07fe169
commit affb47b82e
3 changed files with 14 additions and 4 deletions

View File

@ -4,10 +4,13 @@ Release History
0.9.1 (?)
---------
* Fixed "*OSError: [Errno 2] No such file or directory*" for
* Ask user to install platform (when it hasn't been installed yet) within
`platformio run <http://docs.platformio.ikravets.com/en/latest/userguide/cmd_run.html>`_
and `platformio show <http://docs.platformio.ikravets.com/en/latest/userguide/cmd_show.html>`_ commands
* Improved main `documentation <http://docs.platformio.ikravets.com>`_
* Fixed "*OSError: [Errno 2] No such file or directory*" within
`platformio run <http://docs.platformio.ikravets.com/en/latest/userguide/cmd_run.html>`_
command when PlatformIO isn't installed properly
* Improved main `documentation <http://docs.platformio.ikravets.com>`_
* Fixed example for `Eclipse IDE with Tiva board <https://github.com/ivankravets/platformio/tree/develop/examples/ide-eclipse>`_
(`issue #32 <https://github.com/ivankravets/platformio/issues/32>`_)

View File

@ -59,7 +59,10 @@ def cli(environment, target, upload_port):
telemetry.on_run_environment(config.items(section), envtargets)
p = PlatformFactory().newPlatform(config.get(section, "platform"))
if (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])
result = p.run(variables, envtargets)
secho(result['out'], fg="green")
secho(result['err'],

View File

@ -18,7 +18,11 @@ def cli(platform):
installed=True).keys()
if platform not in installed_platforms:
raise PlatformNotInstalledYet(platform)
if 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)
p = PlatformFactory().newPlatform(platform)
echo("{name:<20} - {info}".format(name=style(p.get_name(), fg="cyan"),