ghosttrap-cli 0.3.27__tar.gz → 0.3.28__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ghosttrap-cli
3
- Version: 0.3.27
3
+ Version: 0.3.28
4
4
  Summary: Watch for errors streaming from ghosttrap.io
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/alex-rowley/ghosttrap-cli
@@ -28,7 +28,7 @@ def _harden_signals():
28
28
  except (OSError, ValueError):
29
29
  pass
30
30
 
31
- __version__ = "0.3.27"
31
+ __version__ = "0.3.28"
32
32
 
33
33
  GHOSTTRAP_SERVER = "wss://ghosttrap.io/stream/"
34
34
  CONFIG_DIR = os.path.expanduser("~/.ghosttrap")
@@ -39,6 +39,19 @@ GITHUB_CLI_RELEASES = "https://api.github.com/repos/alex-rowley/ghosttrap-cli/re
39
39
  VERSION_CHECK_TTL = 86400 # check once per day
40
40
 
41
41
 
42
+ def _is_newer(latest, installed):
43
+ """True only if `latest` is a strictly newer x.y.z than `installed`.
44
+ Unparseable versions return False — staying quiet beats advertising a
45
+ downgrade when a stale or odd version string shows up.
46
+ """
47
+ try:
48
+ lt = tuple(int(x) for x in latest.split("."))
49
+ it = tuple(int(x) for x in installed.split("."))
50
+ except (AttributeError, ValueError):
51
+ return False
52
+ return lt > it
53
+
54
+
42
55
  def _check_cli_version(config):
43
56
  """Check if a newer CLI version is available. Caches for 24h."""
44
57
  last_check = config.get("cli_version_check", 0)
@@ -52,7 +65,7 @@ def _check_cli_version(config):
52
65
  with urllib.request.urlopen(req, timeout=3) as resp:
53
66
  data = json.loads(resp.read())
54
67
  latest = data.get("tag_name", "").lstrip("v")
55
- if latest and latest != __version__:
68
+ if _is_newer(latest, __version__):
56
69
  print(f"ghosttrap-cli {latest} available (you have {__version__})", file=sys.stderr)
57
70
  except Exception:
58
71
  pass
@@ -309,7 +322,7 @@ async def _connect_and_handle(server_url, token, config, once=False):
309
322
  for entry in config.get("repos", {}).values():
310
323
  if f"{entry.get('owner')}/{entry.get('name')}" == cwd_repo:
311
324
  installed = entry.get("sdk_version")
312
- if installed and installed != sdk_latest:
325
+ if installed and _is_newer(sdk_latest, installed):
313
326
  print(f"ghosttrap-sdk {sdk_latest} available (you have {installed})", file=sys.stderr)
314
327
  break
315
328
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ghosttrap-cli
3
- Version: 0.3.27
3
+ Version: 0.3.28
4
4
  Summary: Watch for errors streaming from ghosttrap.io
5
5
  License-Expression: MIT
6
6
  Project-URL: Homepage, https://github.com/alex-rowley/ghosttrap-cli
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "ghosttrap-cli"
7
- version = "0.3.27"
7
+ version = "0.3.28"
8
8
  description = "Watch for errors streaming from ghosttrap.io"
9
9
  readme = "README.md"
10
10
  license = "MIT"
File without changes
File without changes
File without changes