Воркед
This commit is contained in:
1 parent
ac32c55ab9
commit
ee94d8e529
1138 files changed
+55771
-77901
No files matched your search
@@ -1,20 +1,26 @@
|
||||
"""Represents a wheel file and provides access to the various parts of the
|
||||
name that have meaning.
|
||||
"""
|
||||
|
||||
import re
|
||||
from typing import Dict, Iterable, List
|
||||
|
||||
from pip._vendor.packaging.tags import Tag
|
||||
from pip._vendor.packaging.utils import (
|
||||
InvalidWheelFilename as PackagingInvalidWheelName,
|
||||
)
|
||||
from pip._vendor.packaging.utils import parse_wheel_filename
|
||||
|
||||
from pip._internal.exceptions import InvalidWheelFilename
|
||||
from pip._internal.utils.deprecation import deprecated
|
||||
|
||||
|
||||
class Wheel:
|
||||
"""A wheel file"""
|
||||
|
||||
wheel_file_re = re.compile(
|
||||
r"""^(?P<namever>(?P<name>.+?)-(?P<ver>.*?))
|
||||
((-(?P<build>\d[^-]*?))?-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)
|
||||
r"""^(?P<namever>(?P<name>[^\s-]+?)-(?P<ver>[^\s-]*?))
|
||||
((-(?P<build>\d[^-]*?))?-(?P<pyver>[^\s-]+?)-(?P<abi>[^\s-]+?)-(?P<plat>[^\s-]+?)
|
||||
\.whl|\.dist-info)$""",
|
||||
re.VERBOSE,
|
||||
)
|
||||
@@ -28,9 +34,29 @@ class Wheel:
|
||||
raise InvalidWheelFilename(f"{filename} is not a valid wheel filename.")
|
||||
self.filename = filename
|
||||
self.name = wheel_info.group("name").replace("_", "-")
|
||||
# we'll assume "_" means "-" due to wheel naming scheme
|
||||
# (https://github.com/pypa/pip/issues/1150)
|
||||
self.version = wheel_info.group("ver").replace("_", "-")
|
||||
_version = wheel_info.group("ver")
|
||||
if "_" in _version:
|
||||
try:
|
||||
parse_wheel_filename(filename)
|
||||
except PackagingInvalidWheelName as e:
|
||||
deprecated(
|
||||
reason=(
|
||||
f"Wheel filename {filename!r} is not correctly normalised. "
|
||||
"Future versions of pip will raise the following error:\n"
|
||||
f"{e.args[0]}\n\n"
|
||||
),
|
||||
replacement=(
|
||||
"to rename the wheel to use a correctly normalised "
|
||||
"name (this may require updating the version in "
|
||||
"the project metadata)"
|
||||
),
|
||||
gone_in="25.1",
|
||||
issue=12938,
|
||||
)
|
||||
|
||||
_version = _version.replace("_", "-")
|
||||
|
||||
self.version = _version
|
||||
self.build_tag = wheel_info.group("build")
|
||||
self.pyversions = wheel_info.group("pyver").split(".")
|
||||
self.abis = wheel_info.group("abi").split(".")
|
||||
|
||||
Reference in new issue
Block a user