tony-cli 0.3.2__tar.gz → 0.3.3__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.
- {tony_cli-0.3.2/src/tony_cli.egg-info → tony_cli-0.3.3}/PKG-INFO +1 -1
- {tony_cli-0.3.2 → tony_cli-0.3.3}/pyproject.toml +1 -1
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/install.py +29 -4
- {tony_cli-0.3.2 → tony_cli-0.3.3/src/tony_cli.egg-info}/PKG-INFO +1 -1
- {tony_cli-0.3.2 → tony_cli-0.3.3}/LICENSE +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/README.md +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/setup.cfg +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/__init__.py +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/agent.py +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/assets/fonts/Favorit-Bold.woff2 +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/assets/fonts/Favorit-Book.woff2 +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/assets/fonts/Favorit-Regular.woff2 +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/assets/fonts/FavoritMono-Medium.woff2 +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/assets/fonts/FavoritMono-Regular.woff2 +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/assets/viewer.css +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/assets/viewer.js +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/fonts.py +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/hosted.py +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/layout.py +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/page.py +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/payload.py +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/source/__init__.py +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/source/local.py +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli/uninstall.py +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli.egg-info/SOURCES.txt +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli.egg-info/dependency_links.txt +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli.egg-info/entry_points.txt +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli.egg-info/requires.txt +0 -0
- {tony_cli-0.3.2 → tony_cli-0.3.3}/src/tony_cli.egg-info/top_level.txt +0 -0
|
@@ -7,6 +7,7 @@ the root of the environment tony is actually running from.
|
|
|
7
7
|
"""
|
|
8
8
|
|
|
9
9
|
import os
|
|
10
|
+
import re
|
|
10
11
|
import subprocess
|
|
11
12
|
import sys
|
|
12
13
|
|
|
@@ -18,7 +19,13 @@ PKG = "tony-cli"
|
|
|
18
19
|
# an ambient index setting, so on a machine pointed at an internal mirror an
|
|
19
20
|
# update would pull whatever that mirror serves under the name `tony-cli`.
|
|
20
21
|
INDEX = "https://pypi.org/simple"
|
|
21
|
-
|
|
22
|
+
|
|
23
|
+
# The project's page on that same index, asked for as JSON (PEP 691). Not
|
|
24
|
+
# pypi.org/pypi/<name>/json — that one is CDN-cached and runs minutes behind a
|
|
25
|
+
# release, so it will call a version "latest" that an installer has already
|
|
26
|
+
# moved past, and report "already on the latest version" to someone who is not.
|
|
27
|
+
PROJECT = f"{INDEX}/{PKG}/"
|
|
28
|
+
SIMPLE_JSON = "application/vnd.pypi.simple.v1+json"
|
|
22
29
|
|
|
23
30
|
|
|
24
31
|
def indexEnv():
|
|
@@ -101,21 +108,39 @@ def installedOnDisk():
|
|
|
101
108
|
return name[len("tony_cli-"):-len(".dist-info")] or None
|
|
102
109
|
|
|
103
110
|
|
|
111
|
+
def _release(version):
|
|
112
|
+
"""A sortable key for a plain release, or None for anything else.
|
|
113
|
+
|
|
114
|
+
Pre-releases and dev builds sort unpredictably as digit tuples — "1.0.0rc1"
|
|
115
|
+
would read as (1, 0, 0, 1) and outrank 1.0.0 — and `tony update` should not
|
|
116
|
+
move anyone onto one.
|
|
117
|
+
"""
|
|
118
|
+
if not re.fullmatch(r"\d+(?:\.\d+)*", version or ""):
|
|
119
|
+
return None
|
|
120
|
+
return tuple(int(n) for n in version.split("."))
|
|
121
|
+
|
|
122
|
+
|
|
104
123
|
def latestVersion(timeout=10):
|
|
105
|
-
"""The newest
|
|
124
|
+
"""The newest release the index offers, or None if it cannot be asked.
|
|
106
125
|
|
|
107
126
|
Worth one request: without it there is nothing to check the upgrade
|
|
108
127
|
against, and every installer exits 0 for "already at latest" — which is
|
|
109
128
|
indistinguishable from "upgraded" unless you knew the target beforehand.
|
|
110
129
|
"""
|
|
111
130
|
try:
|
|
112
|
-
response = httpx.get(
|
|
131
|
+
response = httpx.get(
|
|
132
|
+
PROJECT, timeout=timeout, headers={"Accept": SIMPLE_JSON},
|
|
133
|
+
follow_redirects=True,
|
|
134
|
+
)
|
|
113
135
|
if response.status_code != 200:
|
|
114
136
|
return None
|
|
115
|
-
|
|
137
|
+
versions = (response.json() or {}).get("versions") or []
|
|
116
138
|
except Exception:
|
|
117
139
|
return None
|
|
118
140
|
|
|
141
|
+
ranked = [(key, v) for v in versions if (key := _release(v))]
|
|
142
|
+
return max(ranked)[1] if ranked else None
|
|
143
|
+
|
|
119
144
|
|
|
120
145
|
def update(argv=()):
|
|
121
146
|
"""`tony update`. Returns an exit code, prints its own messages."""
|
|
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
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|