chore: bump packaging to v24

This commit is contained in:
Daylin Morgan 2024-04-18 14:48:28 -05:00
parent 4c236e96eb
commit c43f2f027c
Signed by: daylin
GPG key ID: 950D13E9719334AD
2 changed files with 18 additions and 11 deletions

View file

@ -131,12 +131,13 @@ PACKAGES = [
Package(
name="packaging",
url="https://github.com/pypa/packaging.git",
rev="23.2",
# v24.0
rev="7a983f7f0068669ead9d4f7571be24d6c0d83eb9",
files=(
("_structures", [[5, 61]]),
("version", [[17, 563]]),
("utils", [[54, 100]]),
("specifiers", [[28, 1030]]),
("specifiers", [[18, 1017]]),
),
basepath=Path(__file__).parent / "packaging/src/packaging",
prefix="""

View file

@ -1363,7 +1363,7 @@ class v_packaging_Specifier(v_packaging_BaseSpecifier):
)
self._prereleases = prereleases
@property # type: ignore
@property
def prereleases(self) -> bool:
if self._prereleases is not None:
return self._prereleases
@ -1425,7 +1425,7 @@ class v_packaging_Specifier(v_packaging_BaseSpecifier):
return operator_callable
def _compare_compatible(self, prospective: v_packaging_Version, spec: str) -> bool:
prefix = ".".join(
prefix = v_packaging__version_join(
list(
itertools.takewhile(
v_packaging__is_not_suffix, v_packaging__version_split(spec)
@ -1549,7 +1549,9 @@ v_packaging__prefix_regex = re.compile("^([0-9]+)((?:a|b|c|rc)[0-9]+)$")
def v_packaging__version_split(version: str) -> List[str]:
result: List[str] = []
for item in version.split("."):
epoch, _, rest = version.rpartition("!")
result.append(epoch or "0")
for item in rest.split("."):
match = v_packaging__prefix_regex.search(item)
if match:
result.extend(match.groups())
@ -1558,6 +1560,11 @@ def v_packaging__version_split(version: str) -> List[str]:
return result
def v_packaging__version_join(components: List[str]) -> str:
epoch, *rest = components
return f"{epoch}!{'.'.join(rest)}"
def v_packaging__is_not_suffix(segment: str) -> bool:
return not any(
segment.startswith(prefix) for prefix in ("dev", "a", "b", "rc", "post")
@ -1574,7 +1581,9 @@ def v_packaging__pad_version(
right_split.append(right[len(right_split[0]) :])
left_split.insert(1, ["0"] * max(0, len(right_split[0]) - len(left_split[0])))
right_split.insert(1, ["0"] * max(0, len(left_split[0]) - len(right_split[0])))
return list(itertools.chain(*left_split)), list(itertools.chain(*right_split))
return list(itertools.chain.from_iterable(left_split)), list(
itertools.chain.from_iterable(right_split)
)
class v_packaging_SpecifierSet(v_packaging_BaseSpecifier):
@ -1582,10 +1591,7 @@ class v_packaging_SpecifierSet(v_packaging_BaseSpecifier):
self, specifiers: str = "", prereleases: Optional[bool] = None
) -> None:
split_specifiers = [s.strip() for s in specifiers.split(",") if s.strip()]
v_packaging_parsed: Set[v_packaging_Specifier] = set()
for specifier in split_specifiers:
v_packaging_parsed.add(v_packaging_Specifier(specifier))
self._specs = frozenset(v_packaging_parsed)
self._specs = frozenset(map(v_packaging_Specifier, split_specifiers))
self._prereleases = prereleases
@property
@ -1631,7 +1637,7 @@ class v_packaging_SpecifierSet(v_packaging_BaseSpecifier):
specifier._prereleases = self._prereleases
else:
raise ValueError(
"Cannot combine v_packaging_SpecifierSets "
"Cannot combine v_packaging_SpecifierSets"
"with True and False prerelease overrides."
)
return specifier