Mercurial > repos > guerler > hhblits
comparison lib/python3.8/site-packages/pip/_internal/distributions/base.py @ 0:9e54283cc701 draft
"planemo upload commit d12c32a45bcd441307e632fca6d9af7d60289d44"
author | guerler |
---|---|
date | Mon, 27 Jul 2020 03:47:31 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:9e54283cc701 |
---|---|
1 import abc | |
2 | |
3 from pip._vendor.six import add_metaclass | |
4 | |
5 from pip._internal.utils.typing import MYPY_CHECK_RUNNING | |
6 | |
7 if MYPY_CHECK_RUNNING: | |
8 from typing import Optional | |
9 | |
10 from pip._vendor.pkg_resources import Distribution | |
11 from pip._internal.req import InstallRequirement | |
12 from pip._internal.index.package_finder import PackageFinder | |
13 | |
14 | |
15 @add_metaclass(abc.ABCMeta) | |
16 class AbstractDistribution(object): | |
17 """A base class for handling installable artifacts. | |
18 | |
19 The requirements for anything installable are as follows: | |
20 | |
21 - we must be able to determine the requirement name | |
22 (or we can't correctly handle the non-upgrade case). | |
23 | |
24 - for packages with setup requirements, we must also be able | |
25 to determine their requirements without installing additional | |
26 packages (for the same reason as run-time dependencies) | |
27 | |
28 - we must be able to create a Distribution object exposing the | |
29 above metadata. | |
30 """ | |
31 | |
32 def __init__(self, req): | |
33 # type: (InstallRequirement) -> None | |
34 super(AbstractDistribution, self).__init__() | |
35 self.req = req | |
36 | |
37 @abc.abstractmethod | |
38 def get_pkg_resources_distribution(self): | |
39 # type: () -> Optional[Distribution] | |
40 raise NotImplementedError() | |
41 | |
42 @abc.abstractmethod | |
43 def prepare_distribution_metadata(self, finder, build_isolation): | |
44 # type: (PackageFinder, bool) -> None | |
45 raise NotImplementedError() |