mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
Allow upgrading to the latest develop version if no new stable release using "platformio upgrade"
This commit is contained in:
@ -34,8 +34,17 @@ def cli():
|
||||
click.secho("Please wait while upgrading PlatformIO ...",
|
||||
fg="yellow")
|
||||
|
||||
to_develop = False
|
||||
try:
|
||||
from pkg_resources import parse_version
|
||||
to_develop = parse_version(last) < parse_version(__version__)
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
cmds = (
|
||||
["pip", "install", "--upgrade", "platformio"],
|
||||
["pip", "install", "--upgrade",
|
||||
"https://github.com/platformio/platformio/archive/develop.zip"
|
||||
if to_develop else "platformio"],
|
||||
["platformio", "--version"]
|
||||
)
|
||||
|
||||
@ -53,10 +62,11 @@ def cli():
|
||||
r = util.exec_command(cmd)
|
||||
|
||||
assert r['returncode'] == 0
|
||||
assert last in r['out'].strip()
|
||||
assert "version" in r['out']
|
||||
actual_version = r['out'].strip().split("version", 1)[1].strip()
|
||||
click.secho(
|
||||
"PlatformIO has been successfully upgraded to %s" % last,
|
||||
fg="green")
|
||||
"PlatformIO has been successfully upgraded to %s" %
|
||||
actual_version, fg="green")
|
||||
click.echo("Release notes: ", nl=False)
|
||||
click.secho("http://docs.platformio.org/en/latest/history.html",
|
||||
fg="cyan")
|
||||
|
Reference in New Issue
Block a user