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.
- {ghosttrap_cli-0.3.27 → ghosttrap_cli-0.3.28}/PKG-INFO +1 -1
- {ghosttrap_cli-0.3.27 → ghosttrap_cli-0.3.28}/ghosttrap_cli/cli.py +16 -3
- {ghosttrap_cli-0.3.27 → ghosttrap_cli-0.3.28}/ghosttrap_cli.egg-info/PKG-INFO +1 -1
- {ghosttrap_cli-0.3.27 → ghosttrap_cli-0.3.28}/pyproject.toml +1 -1
- {ghosttrap_cli-0.3.27 → ghosttrap_cli-0.3.28}/LICENSE +0 -0
- {ghosttrap_cli-0.3.27 → ghosttrap_cli-0.3.28}/README.md +0 -0
- {ghosttrap_cli-0.3.27 → ghosttrap_cli-0.3.28}/ghosttrap_cli/__init__.py +0 -0
- {ghosttrap_cli-0.3.27 → ghosttrap_cli-0.3.28}/ghosttrap_cli.egg-info/SOURCES.txt +0 -0
- {ghosttrap_cli-0.3.27 → ghosttrap_cli-0.3.28}/ghosttrap_cli.egg-info/dependency_links.txt +0 -0
- {ghosttrap_cli-0.3.27 → ghosttrap_cli-0.3.28}/ghosttrap_cli.egg-info/entry_points.txt +0 -0
- {ghosttrap_cli-0.3.27 → ghosttrap_cli-0.3.28}/ghosttrap_cli.egg-info/requires.txt +0 -0
- {ghosttrap_cli-0.3.27 → ghosttrap_cli-0.3.28}/ghosttrap_cli.egg-info/top_level.txt +0 -0
- {ghosttrap_cli-0.3.27 → ghosttrap_cli-0.3.28}/setup.cfg +0 -0
|
@@ -28,7 +28,7 @@ def _harden_signals():
|
|
|
28
28
|
except (OSError, ValueError):
|
|
29
29
|
pass
|
|
30
30
|
|
|
31
|
-
__version__ = "0.3.
|
|
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
|
|
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
|
|
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
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|