comparison env/lib/python3.9/site-packages/pip/_internal/distributions/wheel.py @ 0:4f3585e2f14b draft default tip

"planemo upload commit 60cee0fc7c0cda8592644e1aad72851dec82c959"
author shellac
date Mon, 22 Mar 2021 18:12:50 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:4f3585e2f14b
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
10 from pip._internal.index.package_finder import PackageFinder
11
12
13 class WheelDistribution(AbstractDistribution):
14 """Represents a wheel distribution.
15
16 This does not need any preparation as wheels can be directly unpacked.
17 """
18
19 def get_pkg_resources_distribution(self):
20 # type: () -> Distribution
21 """Loads the metadata from the wheel file into memory and returns a
22 Distribution that uses it, not relying on the wheel file or
23 requirement.
24 """
25 # Set as part of preparation during download.
26 assert self.req.local_file_path
27 # Wheels are never unnamed.
28 assert self.req.name
29
30 with ZipFile(self.req.local_file_path, allowZip64=True) as z:
31 return pkg_resources_distribution_for_wheel(
32 z, self.req.name, self.req.local_file_path
33 )
34
35 def prepare_distribution_metadata(self, finder, build_isolation):
36 # type: (PackageFinder, bool) -> None
37 pass