mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-19 21:03:21 -07:00
Bump packaging from 23.1 to 24.0 (#2274)
* Bump packaging from 23.1 to 24.0 Bumps [packaging](https://github.com/pypa/packaging) from 23.1 to 24.0. - [Release notes](https://github.com/pypa/packaging/releases) - [Changelog](https://github.com/pypa/packaging/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pypa/packaging/compare/23.1...24.0) --- updated-dependencies: - dependency-name: packaging dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * Update packaging==24.0 --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> [skip ci]
This commit is contained in:
parent
a0170a6f3d
commit
4398dfa821
11 changed files with 663 additions and 161 deletions
|
@ -11,17 +11,7 @@
|
|||
import abc
|
||||
import itertools
|
||||
import re
|
||||
from typing import (
|
||||
Callable,
|
||||
Iterable,
|
||||
Iterator,
|
||||
List,
|
||||
Optional,
|
||||
Set,
|
||||
Tuple,
|
||||
TypeVar,
|
||||
Union,
|
||||
)
|
||||
from typing import Callable, Iterable, Iterator, List, Optional, Tuple, TypeVar, Union
|
||||
|
||||
from .utils import canonicalize_version
|
||||
from .version import Version
|
||||
|
@ -383,7 +373,7 @@ class Specifier(BaseSpecifier):
|
|||
|
||||
# We want everything but the last item in the version, but we want to
|
||||
# ignore suffix segments.
|
||||
prefix = ".".join(
|
||||
prefix = _version_join(
|
||||
list(itertools.takewhile(_is_not_suffix, _version_split(spec)))[:-1]
|
||||
)
|
||||
|
||||
|
@ -404,13 +394,13 @@ class Specifier(BaseSpecifier):
|
|||
)
|
||||
# Get the normalized version string ignoring the trailing .*
|
||||
normalized_spec = canonicalize_version(spec[:-2], strip_trailing_zero=False)
|
||||
# Split the spec out by dots, and pretend that there is an implicit
|
||||
# dot in between a release segment and a pre-release segment.
|
||||
# Split the spec out by bangs and dots, and pretend that there is
|
||||
# an implicit dot in between a release segment and a pre-release segment.
|
||||
split_spec = _version_split(normalized_spec)
|
||||
|
||||
# Split the prospective version out by dots, and pretend that there
|
||||
# is an implicit dot in between a release segment and a pre-release
|
||||
# segment.
|
||||
# Split the prospective version out by bangs and dots, and pretend
|
||||
# that there is an implicit dot in between a release segment and
|
||||
# a pre-release segment.
|
||||
split_prospective = _version_split(normalized_prospective)
|
||||
|
||||
# 0-pad the prospective version before shortening it to get the correct
|
||||
|
@ -644,8 +634,19 @@ _prefix_regex = re.compile(r"^([0-9]+)((?:a|b|c|rc)[0-9]+)$")
|
|||
|
||||
|
||||
def _version_split(version: str) -> List[str]:
|
||||
"""Split version into components.
|
||||
|
||||
The split components are intended for version comparison. The logic does
|
||||
not attempt to retain the original version string, so joining the
|
||||
components back with :func:`_version_join` may not produce the original
|
||||
version string.
|
||||
"""
|
||||
result: List[str] = []
|
||||
for item in version.split("."):
|
||||
|
||||
epoch, _, rest = version.rpartition("!")
|
||||
result.append(epoch or "0")
|
||||
|
||||
for item in rest.split("."):
|
||||
match = _prefix_regex.search(item)
|
||||
if match:
|
||||
result.extend(match.groups())
|
||||
|
@ -654,6 +655,17 @@ def _version_split(version: str) -> List[str]:
|
|||
return result
|
||||
|
||||
|
||||
def _version_join(components: List[str]) -> str:
|
||||
"""Join split version components into a version string.
|
||||
|
||||
This function assumes the input came from :func:`_version_split`, where the
|
||||
first component must be the epoch (either empty or numeric), and all other
|
||||
components numeric.
|
||||
"""
|
||||
epoch, *rest = components
|
||||
return f"{epoch}!{'.'.join(rest)}"
|
||||
|
||||
|
||||
def _is_not_suffix(segment: str) -> bool:
|
||||
return not any(
|
||||
segment.startswith(prefix) for prefix in ("dev", "a", "b", "rc", "post")
|
||||
|
@ -675,7 +687,10 @@ def _pad_version(left: List[str], right: List[str]) -> Tuple[List[str], List[str
|
|||
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 SpecifierSet(BaseSpecifier):
|
||||
|
@ -707,14 +722,8 @@ class SpecifierSet(BaseSpecifier):
|
|||
# strip each item to remove leading/trailing whitespace.
|
||||
split_specifiers = [s.strip() for s in specifiers.split(",") if s.strip()]
|
||||
|
||||
# Parsed each individual specifier, attempting first to make it a
|
||||
# Specifier.
|
||||
parsed: Set[Specifier] = set()
|
||||
for specifier in split_specifiers:
|
||||
parsed.add(Specifier(specifier))
|
||||
|
||||
# Turn our parsed specifiers into a frozen set and save them for later.
|
||||
self._specs = frozenset(parsed)
|
||||
# Make each individual specifier a Specifier and save in a frozen set for later.
|
||||
self._specs = frozenset(map(Specifier, split_specifiers))
|
||||
|
||||
# Store our prereleases value so we can use it later to determine if
|
||||
# we accept prereleases or not.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue