comparison lib/python3.8/site-packages/pip/_internal/distributions/wheel.py @ 1:64071f2a4cf0 draft default tip

Deleted selected files
author guerler
date Mon, 27 Jul 2020 03:55:49 -0400
parents 9e54283cc701
children
comparison
equal deleted inserted replaced
0:9e54283cc701 1:64071f2a4cf0
1 from zipfile import ZipFile
2
3 from pip._internal.distributions.base import AbstractDistribution
4 from pip._internal.utils.typing import MYPY_CHECK_RUNNING
5 from pip._internal.utils.wheel import pkg_resources_distribution_for_wheel
6
7 if MYPY_CHECK_RUNNING:
8 from pip._vendor.pkg_resources import Distribution
9 from pip._internal.index.package_finder import PackageFinder
10
11
12 class WheelDistribution(AbstractDistribution):
13 """Represents a wheel distribution.
14
15 This does not need any preparation as wheels can be directly unpacked.
16 """
17
18 def get_pkg_resources_distribution(self):
19 # type: () -> Distribution
20 """Loads the metadata from the wheel file into memory and returns a
21 Distribution that uses it, not relying on the wheel file or
22 requirement.
23 """
24 # Set as part of preparation during download.
25 assert self.req.local_file_path
26 # Wheels are never unnamed.
27 assert self.req.name
28
29 with ZipFile(self.req.local_file_path, allowZip64=True) as z:
30 return pkg_resources_distribution_for_wheel(
31 z, self.req.name, self.req.local_file_path
32 )
33
34 def prepare_distribution_metadata(self, finder, build_isolation):
35 # type: (PackageFinder, bool) -> None
36 pass