forked from platformio/platformio-core
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 ...",
|
click.secho("Please wait while upgrading PlatformIO ...",
|
||||||
fg="yellow")
|
fg="yellow")
|
||||||
|
|
||||||
|
to_develop = False
|
||||||
|
try:
|
||||||
|
from pkg_resources import parse_version
|
||||||
|
to_develop = parse_version(last) < parse_version(__version__)
|
||||||
|
except ImportError:
|
||||||
|
pass
|
||||||
|
|
||||||
cmds = (
|
cmds = (
|
||||||
["pip", "install", "--upgrade", "platformio"],
|
["pip", "install", "--upgrade",
|
||||||
|
"https://github.com/platformio/platformio/archive/develop.zip"
|
||||||
|
if to_develop else "platformio"],
|
||||||
["platformio", "--version"]
|
["platformio", "--version"]
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -53,10 +62,11 @@ def cli():
|
|||||||
r = util.exec_command(cmd)
|
r = util.exec_command(cmd)
|
||||||
|
|
||||||
assert r['returncode'] == 0
|
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(
|
click.secho(
|
||||||
"PlatformIO has been successfully upgraded to %s" % last,
|
"PlatformIO has been successfully upgraded to %s" %
|
||||||
fg="green")
|
actual_version, fg="green")
|
||||||
click.echo("Release notes: ", nl=False)
|
click.echo("Release notes: ", nl=False)
|
||||||
click.secho("http://docs.platformio.org/en/latest/history.html",
|
click.secho("http://docs.platformio.org/en/latest/history.html",
|
||||||
fg="cyan")
|
fg="cyan")
|
||||||
|
Reference in New Issue
Block a user