python (3.12.0)
1 import abc
2
3 from pip._internal.index.package_finder import PackageFinder
4 from pip._internal.metadata.base import BaseDistribution
5 from pip._internal.req import InstallRequirement
6
7
8 class ESC[4;38;5;81mAbstractDistribution(metaclass=ESC[4;38;5;149mabcESC[4;38;5;149m.ESC[4;38;5;149mABCMeta):
9 """A base class for handling installable artifacts.
10
11 The requirements for anything installable are as follows:
12
13 - we must be able to determine the requirement name
14 (or we can't correctly handle the non-upgrade case).
15
16 - for packages with setup requirements, we must also be able
17 to determine their requirements without installing additional
18 packages (for the same reason as run-time dependencies)
19
20 - we must be able to create a Distribution object exposing the
21 above metadata.
22 """
23
24 def __init__(self, req: InstallRequirement) -> None:
25 super().__init__()
26 self.req = req
27
28 @abc.abstractmethod
29 def get_metadata_distribution(self) -> BaseDistribution:
30 raise NotImplementedError()
31
32 @abc.abstractmethod
33 def prepare_distribution_metadata(
34 self,
35 finder: PackageFinder,
36 build_isolation: bool,
37 check_build_deps: bool,
38 ) -> None:
39 raise NotImplementedError()