MCPcopy Create free account
hub / github.com/bigdra50/unity-cli / get_update_message

Function get_update_message

unity_cli/update_checker.py:59–79  ·  view source on GitHub ↗

Return an update notification message if a newer version exists.

(current: str)

Source from the content-addressed store, hash-verified

57
58
59def get_update_message(current: str) -> str | None:
60 """Return an update notification message if a newer version exists."""
61 latest = get_latest_version_cached()
62 if not latest or not current:
63 return None
64 try:
65 from packaging.version import Version
66
67 if Version(latest) > Version(current):
68 return f"Update available: {current} -> {latest}\nRun 'uv tool install --force unity-cli' to update"
69 except ImportError:
70 # packaging not available; fall back to tuple comparison
71 def _parse_version(v: str) -> tuple[int, ...]:
72 return tuple(int(x) for x in v.split("."))
73
74 try:
75 if _parse_version(latest) > _parse_version(current):
76 return f"Update available: {current} -> {latest}\nRun 'uv tool install --force unity-cli' to update"
77 except (ValueError, TypeError):
78 pass
79 return None

Calls 2

_parse_versionFunction · 0.85