Implement "--develop" option for "upgrade" command // Resolve #104

This commit is contained in:
Ivan Kravets
2017-12-13 01:23:18 +02:00
parent f9b9ed317d
commit 786dd8fe18
2 changed files with 6 additions and 5 deletions

2
docs

Submodule docs updated: 81346afbf8...a9bc3dc0ea

View File

@ -24,12 +24,12 @@ from platformio.managers.core import update_core_packages
@click.command( @click.command(
"upgrade", short_help="Upgrade PlatformIO to the latest version") "upgrade", short_help="Upgrade PlatformIO to the latest version")
def cli(): @click.option("--develop", is_flag=True, help="Force development branch")
def cli(develop):
# Update PlatformIO's Core packages # Update PlatformIO's Core packages
update_core_packages(silent=True) update_core_packages(silent=True)
latest = get_latest_version() if not develop and __version__ == get_latest_version():
if __version__ == latest:
return click.secho( return click.secho(
"You're up-to-date!\nPlatformIO %s is currently the " "You're up-to-date!\nPlatformIO %s is currently the "
"newest version available." % __version__, "newest version available." % __version__,
@ -40,7 +40,8 @@ def cli():
# kill all PIO Home servers, they block `pioplus` binary # kill all PIO Home servers, they block `pioplus` binary
shutdown_servers() shutdown_servers()
to_develop = not all([c.isdigit() for c in latest if c != "."]) to_develop = develop or not all(
[c.isdigit() for c in __version__ if c != "."])
cmds = ([ cmds = ([
"pip", "install", "--upgrade", "pip", "install", "--upgrade",
"https://github.com/platformio/platformio-core/archive/develop.zip" "https://github.com/platformio/platformio-core/archive/develop.zip"