-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update vendored packaging version to 24.2 (#4740)
- Loading branch information
Showing
24 changed files
with
1,203 additions
and
172 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Updated vendored packaging version to 24.2. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
uv |
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions
4
..._vendor/packaging-24.1.dist-info/METADATA → ..._vendor/packaging-24.2.dist-info/METADATA
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
Metadata-Version: 2.1 | ||
Metadata-Version: 2.3 | ||
Name: packaging | ||
Version: 24.1 | ||
Version: 24.2 | ||
Summary: Core utilities for Python packages | ||
Author-email: Donald Stufft <[email protected]> | ||
Requires-Python: >=3.8 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
packaging-24.2.dist-info/INSTALLER,sha256=5hhM4Q4mYTT9z6QB6PGpUAW81PGNFrYrdXMj4oM_6ak,2 | ||
packaging-24.2.dist-info/LICENSE,sha256=ytHvW9NA1z4HS6YU0m996spceUDD2MNIUuZcSQlobEg,197 | ||
packaging-24.2.dist-info/LICENSE.APACHE,sha256=DVQuDIgE45qn836wDaWnYhSdxoLXgpRRKH4RuTjpRZQ,10174 | ||
packaging-24.2.dist-info/LICENSE.BSD,sha256=tw5-m3QvHMb5SLNMFqo5_-zpQZY2S8iP8NIYDwAo-sU,1344 | ||
packaging-24.2.dist-info/METADATA,sha256=ohH86s6k5mIfQxY2TS0LcSfADeOFa4BiCC-bxZV-pNs,3204 | ||
packaging-24.2.dist-info/RECORD,, | ||
packaging-24.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 | ||
packaging-24.2.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82 | ||
packaging/__init__.py,sha256=dk4Ta_vmdVJxYHDcfyhvQNw8V3PgSBomKNXqg-D2JDY,494 | ||
packaging/_elffile.py,sha256=cflAQAkE25tzhYmq_aCi72QfbT_tn891tPzfpbeHOwE,3306 | ||
packaging/_manylinux.py,sha256=vl5OCoz4kx80H5rwXKeXWjl9WNISGmr4ZgTpTP9lU9c,9612 | ||
packaging/_musllinux.py,sha256=p9ZqNYiOItGee8KcZFeHF_YcdhVwGHdK6r-8lgixvGQ,2694 | ||
packaging/_parser.py,sha256=s_TvTvDNK0NrM2QB3VKThdWFM4Nc0P6JnkObkl3MjpM,10236 | ||
packaging/_structures.py,sha256=q3eVNmbWJGG_S0Dit_S3Ao8qQqz_5PYTXFAKBZe5yr4,1431 | ||
packaging/_tokenizer.py,sha256=J6v5H7Jzvb-g81xp_2QACKwO7LxHQA6ikryMU7zXwN8,5273 | ||
packaging/licenses/__init__.py,sha256=1x5M1nEYjcgwEbLt0dXwz2ukjr18DiCzC0sraQqJ-Ww,5715 | ||
packaging/licenses/_spdx.py,sha256=oAm1ztPFwlsmCKe7lAAsv_OIOfS1cWDu9bNBkeu-2ns,48398 | ||
packaging/markers.py,sha256=c89TNzB7ZdGYhkovm6PYmqGyHxXlYVaLW591PHUNKD8,10561 | ||
packaging/metadata.py,sha256=YJibM7GYe4re8-0a3OlXmGS-XDgTEoO4tlBt2q25Bng,34762 | ||
packaging/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 | ||
packaging/requirements.py,sha256=gYyRSAdbrIyKDY66ugIDUQjRMvxkH2ALioTmX3tnL6o,2947 | ||
packaging/specifiers.py,sha256=GG1wPNMcL0fMJO68vF53wKMdwnfehDcaI-r9NpTfilA,40074 | ||
packaging/tags.py,sha256=CFqrJzAzc2XNGexerH__T-Y5Iwq7WbsYXsiLERLWxY0,21014 | ||
packaging/utils.py,sha256=0F3Hh9OFuRgrhTgGZUl5K22Fv1YP2tZl1z_2gO6kJiA,5050 | ||
packaging/version.py,sha256=olfyuk_DPbflNkJ4wBWetXQ17c74x3DB501degUv7DY,16676 |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ls/_vendor/packaging-24.1.dist-info/WHEEL → ...ls/_vendor/packaging-24.2.dist-info/WHEEL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Wheel-Version: 1.0 | ||
Generator: flit 3.9.0 | ||
Generator: flit 3.10.1 | ||
Root-Is-Purelib: true | ||
Tag: py3-none-any |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,10 +6,10 @@ | |
__summary__ = "Core utilities for Python packages" | ||
__uri__ = "https://github.com/pypa/packaging" | ||
|
||
__version__ = "24.1" | ||
__version__ = "24.2" | ||
|
||
__author__ = "Donald Stufft and individual contributors" | ||
__email__ = "[email protected]" | ||
|
||
__license__ = "BSD-2-Clause or Apache-2.0" | ||
__copyright__ = "2014 %s" % __author__ | ||
__copyright__ = f"2014 {__author__}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
####################################################################################### | ||
# | ||
# Adapted from: | ||
# https://github.com/pypa/hatch/blob/5352e44/backend/src/hatchling/licenses/parse.py | ||
# | ||
# MIT License | ||
# | ||
# Copyright (c) 2017-present Ofek Lev <[email protected]> | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy of this | ||
# software and associated documentation files (the "Software"), to deal in the Software | ||
# without restriction, including without limitation the rights to use, copy, modify, | ||
# merge, publish, distribute, sublicense, and/or sell copies of the Software, and to | ||
# permit persons to whom the Software is furnished to do so, subject to the following | ||
# conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all copies | ||
# or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | ||
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A | ||
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT | ||
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF | ||
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE | ||
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
# | ||
# | ||
# With additional allowance of arbitrary `LicenseRef-` identifiers, not just | ||
# `LicenseRef-Public-Domain` and `LicenseRef-Proprietary`. | ||
# | ||
####################################################################################### | ||
from __future__ import annotations | ||
|
||
import re | ||
from typing import NewType, cast | ||
|
||
from packaging.licenses._spdx import EXCEPTIONS, LICENSES | ||
|
||
__all__ = [ | ||
"NormalizedLicenseExpression", | ||
"InvalidLicenseExpression", | ||
"canonicalize_license_expression", | ||
] | ||
|
||
license_ref_allowed = re.compile("^[A-Za-z0-9.-]*$") | ||
|
||
NormalizedLicenseExpression = NewType("NormalizedLicenseExpression", str) | ||
|
||
|
||
class InvalidLicenseExpression(ValueError): | ||
"""Raised when a license-expression string is invalid | ||
>>> canonicalize_license_expression("invalid") | ||
Traceback (most recent call last): | ||
... | ||
packaging.licenses.InvalidLicenseExpression: Invalid license expression: 'invalid' | ||
""" | ||
|
||
|
||
def canonicalize_license_expression( | ||
raw_license_expression: str, | ||
) -> NormalizedLicenseExpression: | ||
if not raw_license_expression: | ||
message = f"Invalid license expression: {raw_license_expression!r}" | ||
raise InvalidLicenseExpression(message) | ||
|
||
# Pad any parentheses so tokenization can be achieved by merely splitting on | ||
# whitespace. | ||
license_expression = raw_license_expression.replace("(", " ( ").replace(")", " ) ") | ||
licenseref_prefix = "LicenseRef-" | ||
license_refs = { | ||
ref.lower(): "LicenseRef-" + ref[len(licenseref_prefix) :] | ||
for ref in license_expression.split() | ||
if ref.lower().startswith(licenseref_prefix.lower()) | ||
} | ||
|
||
# Normalize to lower case so we can look up licenses/exceptions | ||
# and so boolean operators are Python-compatible. | ||
license_expression = license_expression.lower() | ||
|
||
tokens = license_expression.split() | ||
|
||
# Rather than implementing boolean logic, we create an expression that Python can | ||
# parse. Everything that is not involved with the grammar itself is treated as | ||
# `False` and the expression should evaluate as such. | ||
python_tokens = [] | ||
for token in tokens: | ||
if token not in {"or", "and", "with", "(", ")"}: | ||
python_tokens.append("False") | ||
elif token == "with": | ||
python_tokens.append("or") | ||
elif token == "(" and python_tokens and python_tokens[-1] not in {"or", "and"}: | ||
message = f"Invalid license expression: {raw_license_expression!r}" | ||
raise InvalidLicenseExpression(message) | ||
else: | ||
python_tokens.append(token) | ||
|
||
python_expression = " ".join(python_tokens) | ||
try: | ||
invalid = eval(python_expression, globals(), locals()) | ||
except Exception: | ||
invalid = True | ||
|
||
if invalid is not False: | ||
message = f"Invalid license expression: {raw_license_expression!r}" | ||
raise InvalidLicenseExpression(message) from None | ||
|
||
# Take a final pass to check for unknown licenses/exceptions. | ||
normalized_tokens = [] | ||
for token in tokens: | ||
if token in {"or", "and", "with", "(", ")"}: | ||
normalized_tokens.append(token.upper()) | ||
continue | ||
|
||
if normalized_tokens and normalized_tokens[-1] == "WITH": | ||
if token not in EXCEPTIONS: | ||
message = f"Unknown license exception: {token!r}" | ||
raise InvalidLicenseExpression(message) | ||
|
||
normalized_tokens.append(EXCEPTIONS[token]["id"]) | ||
else: | ||
if token.endswith("+"): | ||
final_token = token[:-1] | ||
suffix = "+" | ||
else: | ||
final_token = token | ||
suffix = "" | ||
|
||
if final_token.startswith("licenseref-"): | ||
if not license_ref_allowed.match(final_token): | ||
message = f"Invalid licenseref: {final_token!r}" | ||
raise InvalidLicenseExpression(message) | ||
normalized_tokens.append(license_refs[final_token] + suffix) | ||
else: | ||
if final_token not in LICENSES: | ||
message = f"Unknown license: {final_token!r}" | ||
raise InvalidLicenseExpression(message) | ||
normalized_tokens.append(LICENSES[final_token]["id"] + suffix) | ||
|
||
normalized_expression = " ".join(normalized_tokens) | ||
|
||
return cast( | ||
NormalizedLicenseExpression, | ||
normalized_expression.replace("( ", "(").replace(" )", ")"), | ||
) |
Oops, something went wrong.