Skip to content

Commit a8596d8

Browse files
committed
Merge pull request #17983 from ydb-platform/merge-libs-250505-0050
2 parents 4834130 + 16a995c commit a8596d8

File tree

14 files changed

+112
-43
lines changed

14 files changed

+112
-43
lines changed

contrib/python/packaging/py3/.dist-info/METADATA

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
Metadata-Version: 2.3
1+
Metadata-Version: 2.4
22
Name: packaging
3-
Version: 24.2
3+
Version: 25.0
44
Summary: Core utilities for Python packages
55
Author-email: Donald Stufft <[email protected]>
66
Requires-Python: >=3.8
@@ -21,6 +21,9 @@ Classifier: Programming Language :: Python :: 3.13
2121
Classifier: Programming Language :: Python :: Implementation :: CPython
2222
Classifier: Programming Language :: Python :: Implementation :: PyPy
2323
Classifier: Typing :: Typed
24+
License-File: LICENSE
25+
License-File: LICENSE.APACHE
26+
License-File: LICENSE.BSD
2427
Project-URL: Documentation, https://packaging.pypa.io/
2528
Project-URL: Source, https://github.com/pypa/packaging
2629

contrib/python/packaging/py3/packaging/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
__summary__ = "Core utilities for Python packages"
77
__uri__ = "https://github.com/pypa/packaging"
88

9-
__version__ = "24.2"
9+
__version__ = "25.0"
1010

1111
__author__ = "Donald Stufft and individual contributors"
1212
__email__ = "[email protected]"

contrib/python/packaging/py3/packaging/_elffile.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ def __init__(self, f: IO[bytes]) -> None:
6969
}[(self.capacity, self.encoding)]
7070
except KeyError as e:
7171
raise ELFInvalid(
72-
f"unrecognized capacity ({self.capacity}) or "
73-
f"encoding ({self.encoding})"
72+
f"unrecognized capacity ({self.capacity}) or encoding ({self.encoding})"
7473
) from e
7574

7675
try:

contrib/python/packaging/py3/packaging/_manylinux.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,7 @@ def _parse_glibc_version(version_str: str) -> tuple[int, int]:
161161
m = re.match(r"(?P<major>[0-9]+)\.(?P<minor>[0-9]+)", version_str)
162162
if not m:
163163
warnings.warn(
164-
f"Expected glibc version with 2 components major.minor,"
165-
f" got: {version_str}",
164+
f"Expected glibc version with 2 components major.minor, got: {version_str}",
166165
RuntimeWarning,
167166
stacklevel=2,
168167
)

contrib/python/packaging/py3/packaging/_parser.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,5 @@ def _parse_marker_op(tokenizer: Tokenizer) -> Op:
349349
return Op(tokenizer.read().text)
350350
else:
351351
return tokenizer.raise_syntax_error(
352-
"Expected marker operator, one of "
353-
"<=, <, !=, ==, >=, >, ~=, ===, in, not in"
352+
"Expected marker operator, one of <=, <, !=, ==, >=, >, ~=, ===, in, not in"
354353
)

contrib/python/packaging/py3/packaging/_tokenizer.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ def __str__(self) -> str:
6868
|platform[._](version|machine|python_implementation)
6969
|python_implementation
7070
|implementation_(name|version)
71-
|extra
71+
|extras?
72+
|dependency_groups
7273
)\b
7374
""",
7475
re.VERBOSE,
@@ -119,9 +120,9 @@ def check(self, name: str, *, peek: bool = False) -> bool:
119120
another check. If `peek` is set to `True`, the token is not loaded and
120121
would need to be checked again.
121122
"""
122-
assert (
123-
self.next_token is None
124-
), f"Cannot check for {name!r}, already have {self.next_token!r}"
123+
assert self.next_token is None, (
124+
f"Cannot check for {name!r}, already have {self.next_token!r}"
125+
)
125126
assert name in self.rules, f"Unknown token name: {name!r}"
126127

127128
expression = self.rules[name]

contrib/python/packaging/py3/packaging/licenses/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@
3737
from packaging.licenses._spdx import EXCEPTIONS, LICENSES
3838

3939
__all__ = [
40-
"NormalizedLicenseExpression",
4140
"InvalidLicenseExpression",
41+
"NormalizedLicenseExpression",
4242
"canonicalize_license_expression",
4343
]
4444

contrib/python/packaging/py3/packaging/markers.py

+53-22
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import os
99
import platform
1010
import sys
11-
from typing import Any, Callable, TypedDict, cast
11+
from typing import AbstractSet, Any, Callable, Literal, TypedDict, Union, cast
1212

1313
from ._parser import MarkerAtom, MarkerList, Op, Value, Variable
1414
from ._parser import parse_marker as _parse_marker
@@ -17,14 +17,17 @@
1717
from .utils import canonicalize_name
1818

1919
__all__ = [
20+
"EvaluateContext",
2021
"InvalidMarker",
2122
"Marker",
2223
"UndefinedComparison",
2324
"UndefinedEnvironmentName",
2425
"default_environment",
2526
]
2627

27-
Operator = Callable[[str, str], bool]
28+
Operator = Callable[[str, Union[str, AbstractSet[str]]], bool]
29+
EvaluateContext = Literal["metadata", "lock_file", "requirement"]
30+
MARKERS_ALLOWING_SET = {"extras", "dependency_groups"}
2831

2932

3033
class InvalidMarker(ValueError):
@@ -174,13 +177,14 @@ def _format_marker(
174177
}
175178

176179

177-
def _eval_op(lhs: str, op: Op, rhs: str) -> bool:
178-
try:
179-
spec = Specifier("".join([op.serialize(), rhs]))
180-
except InvalidSpecifier:
181-
pass
182-
else:
183-
return spec.contains(lhs, prereleases=True)
180+
def _eval_op(lhs: str, op: Op, rhs: str | AbstractSet[str]) -> bool:
181+
if isinstance(rhs, str):
182+
try:
183+
spec = Specifier("".join([op.serialize(), rhs]))
184+
except InvalidSpecifier:
185+
pass
186+
else:
187+
return spec.contains(lhs, prereleases=True)
184188

185189
oper: Operator | None = _operators.get(op.serialize())
186190
if oper is None:
@@ -189,19 +193,29 @@ def _eval_op(lhs: str, op: Op, rhs: str) -> bool:
189193
return oper(lhs, rhs)
190194

191195

192-
def _normalize(*values: str, key: str) -> tuple[str, ...]:
196+
def _normalize(
197+
lhs: str, rhs: str | AbstractSet[str], key: str
198+
) -> tuple[str, str | AbstractSet[str]]:
193199
# PEP 685 – Comparison of extra names for optional distribution dependencies
194200
# https://peps.python.org/pep-0685/
195201
# > When comparing extra names, tools MUST normalize the names being
196202
# > compared using the semantics outlined in PEP 503 for names
197203
if key == "extra":
198-
return tuple(canonicalize_name(v) for v in values)
204+
assert isinstance(rhs, str), "extra value must be a string"
205+
return (canonicalize_name(lhs), canonicalize_name(rhs))
206+
if key in MARKERS_ALLOWING_SET:
207+
if isinstance(rhs, str): # pragma: no cover
208+
return (canonicalize_name(lhs), canonicalize_name(rhs))
209+
else:
210+
return (canonicalize_name(lhs), {canonicalize_name(v) for v in rhs})
199211

200212
# other environment markers don't have such standards
201-
return values
213+
return lhs, rhs
202214

203215

204-
def _evaluate_markers(markers: MarkerList, environment: dict[str, str]) -> bool:
216+
def _evaluate_markers(
217+
markers: MarkerList, environment: dict[str, str | AbstractSet[str]]
218+
) -> bool:
205219
groups: list[list[bool]] = [[]]
206220

207221
for marker in markers:
@@ -220,7 +234,7 @@ def _evaluate_markers(markers: MarkerList, environment: dict[str, str]) -> bool:
220234
lhs_value = lhs.value
221235
environment_key = rhs.value
222236
rhs_value = environment[environment_key]
223-
237+
assert isinstance(lhs_value, str), "lhs must be a string"
224238
lhs_value, rhs_value = _normalize(lhs_value, rhs_value, key=environment_key)
225239
groups[-1].append(_eval_op(lhs_value, op, rhs_value))
226240
else:
@@ -298,34 +312,51 @@ def __eq__(self, other: Any) -> bool:
298312

299313
return str(self) == str(other)
300314

301-
def evaluate(self, environment: dict[str, str] | None = None) -> bool:
315+
def evaluate(
316+
self,
317+
environment: dict[str, str] | None = None,
318+
context: EvaluateContext = "metadata",
319+
) -> bool:
302320
"""Evaluate a marker.
303321
304322
Return the boolean from evaluating the given marker against the
305323
environment. environment is an optional argument to override all or
306-
part of the determined environment.
324+
part of the determined environment. The *context* parameter specifies what
325+
context the markers are being evaluated for, which influences what markers
326+
are considered valid. Acceptable values are "metadata" (for core metadata;
327+
default), "lock_file", and "requirement" (i.e. all other situations).
307328
308329
The environment is determined from the current Python process.
309330
"""
310-
current_environment = cast("dict[str, str]", default_environment())
311-
current_environment["extra"] = ""
331+
current_environment = cast(
332+
"dict[str, str | AbstractSet[str]]", default_environment()
333+
)
334+
if context == "lock_file":
335+
current_environment.update(
336+
extras=frozenset(), dependency_groups=frozenset()
337+
)
338+
elif context == "metadata":
339+
current_environment["extra"] = ""
312340
if environment is not None:
313341
current_environment.update(environment)
314342
# The API used to allow setting extra to None. We need to handle this
315343
# case for backwards compatibility.
316-
if current_environment["extra"] is None:
344+
if "extra" in current_environment and current_environment["extra"] is None:
317345
current_environment["extra"] = ""
318346

319347
return _evaluate_markers(
320348
self._markers, _repair_python_full_version(current_environment)
321349
)
322350

323351

324-
def _repair_python_full_version(env: dict[str, str]) -> dict[str, str]:
352+
def _repair_python_full_version(
353+
env: dict[str, str | AbstractSet[str]],
354+
) -> dict[str, str | AbstractSet[str]]:
325355
"""
326356
Work around platform.python_version() returning something that is not PEP 440
327357
compliant for non-tagged Python builds.
328358
"""
329-
if env["python_full_version"].endswith("+"):
330-
env["python_full_version"] += "local"
359+
python_full_version = cast(str, env["python_full_version"])
360+
if python_full_version.endswith("+"):
361+
env["python_full_version"] = f"{python_full_version}local"
331362
return env

contrib/python/packaging/py3/packaging/metadata.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -678,8 +678,7 @@ def _process_license_files(self, value: list[str]) -> list[str]:
678678
)
679679
if pathlib.PureWindowsPath(path).as_posix() != path:
680680
raise self._invalid_metadata(
681-
f"{path!r} is invalid for {{field}}, "
682-
"paths must use '/' delimiter"
681+
f"{path!r} is invalid for {{field}}, paths must use '/' delimiter"
683682
)
684683
paths.append(path)
685684
return paths

contrib/python/packaging/py3/packaging/specifiers.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -816,8 +816,7 @@ def __and__(self, other: SpecifierSet | str) -> SpecifierSet:
816816
specifier._prereleases = self._prereleases
817817
else:
818818
raise ValueError(
819-
"Cannot combine SpecifierSets with True and False prerelease "
820-
"overrides."
819+
"Cannot combine SpecifierSets with True and False prerelease overrides."
821820
)
822821

823822
return specifier

contrib/python/packaging/py3/packaging/tags.py

+39
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,43 @@ def ios_platforms(
530530
)
531531

532532

533+
def android_platforms(
534+
api_level: int | None = None, abi: str | None = None
535+
) -> Iterator[str]:
536+
"""
537+
Yields the :attr:`~Tag.platform` tags for Android. If this function is invoked on
538+
non-Android platforms, the ``api_level`` and ``abi`` arguments are required.
539+
540+
:param int api_level: The maximum `API level
541+
<https://developer.android.com/tools/releases/platforms>`__ to return. Defaults
542+
to the current system's version, as returned by ``platform.android_ver``.
543+
:param str abi: The `Android ABI <https://developer.android.com/ndk/guides/abis>`__,
544+
e.g. ``arm64_v8a``. Defaults to the current system's ABI , as returned by
545+
``sysconfig.get_platform``. Hyphens and periods will be replaced with
546+
underscores.
547+
"""
548+
if platform.system() != "Android" and (api_level is None or abi is None):
549+
raise TypeError(
550+
"on non-Android platforms, the api_level and abi arguments are required"
551+
)
552+
553+
if api_level is None:
554+
# Python 3.13 was the first version to return platform.system() == "Android",
555+
# and also the first version to define platform.android_ver().
556+
api_level = platform.android_ver().api_level # type: ignore[attr-defined]
557+
558+
if abi is None:
559+
abi = sysconfig.get_platform().split("-")[-1]
560+
abi = _normalize_string(abi)
561+
562+
# 16 is the minimum API level known to have enough features to support CPython
563+
# without major patching. Yield every API level from the maximum down to the
564+
# minimum, inclusive.
565+
min_api_level = 16
566+
for ver in range(api_level, min_api_level - 1, -1):
567+
yield f"android_{ver}_{abi}"
568+
569+
533570
def _linux_platforms(is_32bit: bool = _32_BIT_INTERPRETER) -> Iterator[str]:
534571
linux = _normalize_string(sysconfig.get_platform())
535572
if not linux.startswith("linux_"):
@@ -561,6 +598,8 @@ def platform_tags() -> Iterator[str]:
561598
return mac_platforms()
562599
elif platform.system() == "iOS":
563600
return ios_platforms()
601+
elif platform.system() == "Android":
602+
return android_platforms()
564603
elif platform.system() == "Linux":
565604
return _linux_platforms()
566605
else:

contrib/python/packaging/py3/ya.make

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
PY3_LIBRARY()
44

5-
VERSION(24.2)
5+
VERSION(25.0)
66

77
LICENSE(BSD-2-Clause AND Apache-2.0)
88

library/cpp/tld/tlds-alpha-by-domain.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Version 2025050100, Last Updated Thu May 1 07:07:02 2025 UTC
1+
# Version 2025050301, Last Updated Sun May 4 07:07:02 2025 UTC
22
AAA
33
AARP
44
ABB

ydb/ci/rightlib.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4c780f0058b83cbc54813f40a3e7d1816e5c04c7
1+
74c68d5ada88cc1acc7c521cd2570838fce6607e

0 commit comments

Comments
 (0)