Mercurial > repos > shellac > sam_consensus_v3
comparison env/lib/python3.9/site-packages/pip/_internal/distributions/base.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 import abc | |
2 | |
3 from pip._internal.utils.typing import MYPY_CHECK_RUNNING | |
4 | |
5 if MYPY_CHECK_RUNNING: | |
6 from typing import Optional | |
7 | |
8 from pip._vendor.pkg_resources import Distribution | |
9 | |
10 from pip._internal.index.package_finder import PackageFinder | |
11 from pip._internal.req import InstallRequirement | |
12 | |
13 | |
14 class AbstractDistribution(metaclass=abc.ABCMeta): | |
15 """A base class for handling installable artifacts. | |
16 | |
17 The requirements for anything installable are as follows: | |
18 | |
19 - we must be able to determine the requirement name | |
20 (or we can't correctly handle the non-upgrade case). | |
21 | |
22 - for packages with setup requirements, we must also be able | |
23 to determine their requirements without installing additional | |
24 packages (for the same reason as run-time dependencies) | |
25 | |
26 - we must be able to create a Distribution object exposing the | |
27 above metadata. | |
28 """ | |
29 def __init__(self, req): | |
30 # type: (InstallRequirement) -> None | |
31 super().__init__() | |
32 self.req = req | |
33 | |
34 @abc.abstractmethod | |
35 def get_pkg_resources_distribution(self): | |
36 # type: () -> Optional[Distribution] | |
37 raise NotImplementedError() | |
38 | |
39 @abc.abstractmethod | |
40 def prepare_distribution_metadata(self, finder, build_isolation): | |
41 # type: (PackageFinder, bool) -> None | |
42 raise NotImplementedError() |