2023-08-01 02:21:23 +02:00
|
|
|
from typing import Optional
|
|
|
|
|
2021-08-22 20:07:33 +02:00
|
|
|
from pip._vendor.packaging.utils import canonicalize_name
|
2021-02-19 13:56:59 +01:00
|
|
|
|
2019-06-14 17:37:51 +02:00
|
|
|
from pip._internal.distributions.base import AbstractDistribution
|
2021-02-19 13:56:59 +01:00
|
|
|
from pip._internal.index.package_finder import PackageFinder
|
2021-08-22 20:07:33 +02:00
|
|
|
from pip._internal.metadata import (
|
|
|
|
BaseDistribution,
|
|
|
|
FilesystemWheel,
|
|
|
|
get_wheel_distribution,
|
|
|
|
)
|
2019-12-12 14:00:44 +01:00
|
|
|
|
2019-06-14 17:37:51 +02:00
|
|
|
|
|
|
|
class WheelDistribution(AbstractDistribution):
|
2019-06-14 19:55:05 +02:00
|
|
|
"""Represents a wheel distribution.
|
|
|
|
|
|
|
|
This does not need any preparation as wheels can be directly unpacked.
|
|
|
|
"""
|
2019-06-14 17:37:51 +02:00
|
|
|
|
2023-08-01 02:21:23 +02:00
|
|
|
@property
|
|
|
|
def build_tracker_id(self) -> Optional[str]:
|
|
|
|
return None
|
|
|
|
|
2021-08-22 20:07:33 +02:00
|
|
|
def get_metadata_distribution(self) -> BaseDistribution:
|
2020-01-02 02:29:11 +01:00
|
|
|
"""Loads the metadata from the wheel file into memory and returns a
|
|
|
|
Distribution that uses it, not relying on the wheel file or
|
|
|
|
requirement.
|
|
|
|
"""
|
2021-08-22 20:07:33 +02:00
|
|
|
assert self.req.local_file_path, "Set as part of preparation during download"
|
|
|
|
assert self.req.name, "Wheels are never unnamed"
|
|
|
|
wheel = FilesystemWheel(self.req.local_file_path)
|
|
|
|
return get_wheel_distribution(wheel, canonicalize_name(self.req.name))
|
2019-06-14 17:37:51 +02:00
|
|
|
|
2021-07-13 00:29:21 +02:00
|
|
|
def prepare_distribution_metadata(
|
2022-05-12 20:23:19 +02:00
|
|
|
self,
|
|
|
|
finder: PackageFinder,
|
|
|
|
build_isolation: bool,
|
|
|
|
check_build_deps: bool,
|
2021-07-13 00:29:21 +02:00
|
|
|
) -> None:
|
2019-06-14 17:37:51 +02:00
|
|
|
pass
|