mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-31 10:37:13 +02:00
Use "Updating to X.Y.Z" instead of "Outdated" when doing a real package updating
This commit is contained in:
@ -104,7 +104,7 @@ class PackageManagerUpdateMixin(object):
|
|||||||
|
|
||||||
outdated = self.outdated(pkg, to_spec)
|
outdated = self.outdated(pkg, to_spec)
|
||||||
if not silent:
|
if not silent:
|
||||||
self.print_outdated_state(outdated, show_incompatible)
|
self.print_outdated_state(outdated, only_check, show_incompatible)
|
||||||
|
|
||||||
if only_check or not outdated.is_outdated(allow_incompatible=False):
|
if only_check or not outdated.is_outdated(allow_incompatible=False):
|
||||||
return pkg
|
return pkg
|
||||||
@ -116,24 +116,39 @@ class PackageManagerUpdateMixin(object):
|
|||||||
self.unlock()
|
self.unlock()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def print_outdated_state(outdated, show_incompatible=True):
|
def print_outdated_state(outdated, only_check, show_incompatible):
|
||||||
if outdated.detached:
|
if outdated.detached:
|
||||||
return click.echo("[%s]" % (click.style("Detached", fg="yellow")))
|
return click.echo("[%s]" % (click.style("Detached", fg="yellow")))
|
||||||
|
|
||||||
if (
|
if (
|
||||||
not outdated.latest
|
not outdated.latest
|
||||||
or outdated.current == outdated.latest
|
or outdated.current == outdated.latest
|
||||||
or (not show_incompatible and outdated.current == outdated.wanted)
|
or (not show_incompatible and outdated.current == outdated.wanted)
|
||||||
):
|
):
|
||||||
return click.echo("[%s]" % (click.style("Up-to-date", fg="green")))
|
return click.echo("[%s]" % (click.style("Up-to-date", fg="green")))
|
||||||
|
|
||||||
if outdated.wanted and outdated.current == outdated.wanted:
|
if outdated.wanted and outdated.current == outdated.wanted:
|
||||||
return click.echo(
|
return click.echo(
|
||||||
"[%s]" % (click.style("Incompatible %s" % outdated.latest, fg="yellow"))
|
"[%s]" % (click.style("Incompatible %s" % outdated.latest, fg="yellow"))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if only_check:
|
||||||
|
return click.echo(
|
||||||
|
"[%s]"
|
||||||
|
% (
|
||||||
|
click.style(
|
||||||
|
"Outdated %s" % str(outdated.wanted or outdated.latest),
|
||||||
|
fg="red",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
return click.echo(
|
return click.echo(
|
||||||
"[%s]"
|
"[%s]"
|
||||||
% (
|
% (
|
||||||
click.style(
|
click.style(
|
||||||
"Outdated %s" % str(outdated.wanted or outdated.latest), fg="red"
|
"Updating to %s" % str(outdated.wanted or outdated.latest),
|
||||||
|
fg="green",
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -91,7 +91,7 @@ def test_check_and_update_libraries(clirunner, isolated_pio_core, validate_clire
|
|||||||
assert "There are the new updates for libraries (ArduinoJson)" in result.output
|
assert "There are the new updates for libraries (ArduinoJson)" in result.output
|
||||||
assert "Please wait while updating libraries" in result.output
|
assert "Please wait while updating libraries" in result.output
|
||||||
assert re.search(
|
assert re.search(
|
||||||
r"Updating bblanchon/ArduinoJson\s+6\.12\.0\s+\[Outdated [\d\.]+\]",
|
r"Updating bblanchon/ArduinoJson\s+6\.12\.0\s+\[Updating to [\d\.]+\]",
|
||||||
result.output,
|
result.output,
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -143,7 +143,9 @@ def test_check_and_update_platforms(clirunner, isolated_pio_core, validate_clire
|
|||||||
validate_cliresult(result)
|
validate_cliresult(result)
|
||||||
assert "There are the new updates for platforms (native)" in result.output
|
assert "There are the new updates for platforms (native)" in result.output
|
||||||
assert "Please wait while updating platforms" in result.output
|
assert "Please wait while updating platforms" in result.output
|
||||||
assert re.search(r"Updating native\s+0.0.0\s+\[Outdated [\d\.]+\]", result.output)
|
assert re.search(
|
||||||
|
r"Updating native\s+0.0.0\s+\[Updating to [\d\.]+\]", result.output
|
||||||
|
)
|
||||||
|
|
||||||
# check updated version
|
# check updated version
|
||||||
result = clirunner.invoke(cli_pio, ["platform", "list", "--json-output"])
|
result = clirunner.invoke(cli_pio, ["platform", "list", "--json-output"])
|
||||||
|
Reference in New Issue
Block a user