pyselfupdate 0.8.2__tar.gz → 0.8.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.
- {pyselfupdate-0.8.2 → pyselfupdate-0.8.3}/PKG-INFO +1 -1
- {pyselfupdate-0.8.2 → pyselfupdate-0.8.3}/src/pyselfupdate/config.py +13 -17
- {pyselfupdate-0.8.2 → pyselfupdate-0.8.3}/src/pyselfupdate/version.py +8 -7
- {pyselfupdate-0.8.2 → pyselfupdate-0.8.3}/.gitignore +0 -0
- {pyselfupdate-0.8.2 → pyselfupdate-0.8.3}/LICENSE +0 -0
- {pyselfupdate-0.8.2 → pyselfupdate-0.8.3}/README.md +0 -0
- {pyselfupdate-0.8.2 → pyselfupdate-0.8.3}/pyproject.toml +0 -0
- {pyselfupdate-0.8.2 → pyselfupdate-0.8.3}/src/pyselfupdate/__init__.py +0 -0
- {pyselfupdate-0.8.2 → pyselfupdate-0.8.3}/src/pyselfupdate/errors.py +0 -0
- {pyselfupdate-0.8.2 → pyselfupdate-0.8.3}/src/pyselfupdate/github.py +0 -0
- {pyselfupdate-0.8.2 → pyselfupdate-0.8.3}/src/pyselfupdate/install.py +0 -0
- {pyselfupdate-0.8.2 → pyselfupdate-0.8.3}/src/pyselfupdate/notifier.py +0 -0
- {pyselfupdate-0.8.2 → pyselfupdate-0.8.3}/src/pyselfupdate/py.typed +0 -0
- {pyselfupdate-0.8.2 → pyselfupdate-0.8.3}/src/pyselfupdate/source.py +0 -0
- {pyselfupdate-0.8.2 → pyselfupdate-0.8.3}/src/pyselfupdate/state.py +0 -0
- {pyselfupdate-0.8.2 → pyselfupdate-0.8.3}/src/pyselfupdate/typercmd.py +0 -0
- {pyselfupdate-0.8.2 → pyselfupdate-0.8.3}/src/pyselfupdate/updater.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: pyselfupdate
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.3
|
|
4
4
|
Summary: Self-update and update notification for Python CLIs installed with uv tool
|
|
5
5
|
Project-URL: Repository, https://github.com/datapointchris/pyselfupdate
|
|
6
6
|
Project-URL: Issues, https://github.com/datapointchris/pyselfupdate/issues
|
|
@@ -5,6 +5,8 @@ from __future__ import annotations
|
|
|
5
5
|
from collections.abc import Callable
|
|
6
6
|
from dataclasses import dataclass
|
|
7
7
|
from dataclasses import field
|
|
8
|
+
from dataclasses import fields
|
|
9
|
+
from dataclasses import replace
|
|
8
10
|
|
|
9
11
|
from pyselfupdate.errors import InvalidConfigError
|
|
10
12
|
from pyselfupdate.github import GitHubSource
|
|
@@ -92,31 +94,25 @@ class Config:
|
|
|
92
94
|
if source is None:
|
|
93
95
|
if not owner:
|
|
94
96
|
raise InvalidConfigError('owner is required without a custom source')
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
token=self.token,
|
|
99
|
-
token_func=self.token_func,
|
|
100
|
-
timeout=self.timeout,
|
|
101
|
-
allow_prerelease=self.allow_prerelease,
|
|
102
|
-
tag_prefix=self.tag_prefix,
|
|
103
|
-
)
|
|
97
|
+
settings = {name: getattr(self, name) for name in _GITHUB_SETTINGS}
|
|
98
|
+
settings['repo'] = repo
|
|
99
|
+
built = GitHubSource(**settings)
|
|
104
100
|
if built != self._github:
|
|
105
101
|
self._github = built
|
|
106
102
|
source = self._github
|
|
107
103
|
|
|
108
104
|
package = self.package or self.tool
|
|
109
|
-
return
|
|
110
|
-
|
|
111
|
-
owner=owner,
|
|
105
|
+
return replace(
|
|
106
|
+
self,
|
|
112
107
|
repo=repo,
|
|
113
108
|
package=package,
|
|
114
109
|
version=self.version or current_version(package),
|
|
115
|
-
token=self.token,
|
|
116
|
-
token_func=self.token_func,
|
|
117
|
-
timeout=self.timeout,
|
|
118
|
-
allow_prerelease=self.allow_prerelease,
|
|
119
|
-
tag_prefix=self.tag_prefix,
|
|
120
110
|
source=source,
|
|
121
111
|
metadata=self.metadata.copy(),
|
|
122
112
|
)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
# The settings the default GitHubSource takes from a Config: every field the two
|
|
116
|
+
# declare alike, so a setting added to both reaches the source without being
|
|
117
|
+
# named again here.
|
|
118
|
+
_GITHUB_SETTINGS = frozenset(f.name for f in fields(GitHubSource) if f.init) & frozenset(f.name for f in fields(Config) if f.init)
|
|
@@ -16,8 +16,9 @@ from __future__ import annotations
|
|
|
16
16
|
import re
|
|
17
17
|
from dataclasses import dataclass
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
# Each is applied with `fullmatch`, because `$` also matches before a trailing newline.
|
|
20
|
+
IDENTIFIER_PATTERN = re.compile(r'[0-9A-Za-z-]+')
|
|
21
|
+
NUMERIC_PATTERN = re.compile(r'[0-9]+')
|
|
21
22
|
|
|
22
23
|
|
|
23
24
|
@dataclass(frozen=True)
|
|
@@ -68,7 +69,7 @@ def parse(text: str) -> Version | None:
|
|
|
68
69
|
|
|
69
70
|
def parse_numeric(field: str) -> int | None:
|
|
70
71
|
"""A numeric component, rejecting the leading zeros the spec disallows."""
|
|
71
|
-
if not NUMERIC_PATTERN.
|
|
72
|
+
if not NUMERIC_PATTERN.fullmatch(field):
|
|
72
73
|
return None
|
|
73
74
|
if len(field) > 1 and field[0] == '0':
|
|
74
75
|
return None
|
|
@@ -79,10 +80,10 @@ def is_valid_prerelease(prerelease: str) -> bool:
|
|
|
79
80
|
if not prerelease:
|
|
80
81
|
return False
|
|
81
82
|
for identifier in prerelease.split('.'):
|
|
82
|
-
if not IDENTIFIER_PATTERN.
|
|
83
|
+
if not IDENTIFIER_PATTERN.fullmatch(identifier):
|
|
83
84
|
return False
|
|
84
85
|
# A numeric identifier may not carry leading zeros.
|
|
85
|
-
if NUMERIC_PATTERN.
|
|
86
|
+
if NUMERIC_PATTERN.fullmatch(identifier) and len(identifier) > 1 and identifier[0] == '0':
|
|
86
87
|
return False
|
|
87
88
|
return True
|
|
88
89
|
|
|
@@ -157,8 +158,8 @@ def compare_prerelease(a: str, b: str) -> int:
|
|
|
157
158
|
|
|
158
159
|
|
|
159
160
|
def compare_identifier(a: str, b: str) -> int:
|
|
160
|
-
a_numeric = bool(NUMERIC_PATTERN.
|
|
161
|
-
b_numeric = bool(NUMERIC_PATTERN.
|
|
161
|
+
a_numeric = bool(NUMERIC_PATTERN.fullmatch(a))
|
|
162
|
+
b_numeric = bool(NUMERIC_PATTERN.fullmatch(b))
|
|
162
163
|
|
|
163
164
|
if a_numeric and b_numeric:
|
|
164
165
|
# Compared as integers rather than strings so that 2 ranks below 11.
|
|
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
|