Path: blob/main/test/lib/python3.9/site-packages/pip/_internal/distributions/base.py
4804 views
import abc12from pip._internal.index.package_finder import PackageFinder3from pip._internal.metadata.base import BaseDistribution4from pip._internal.req import InstallRequirement567class AbstractDistribution(metaclass=abc.ABCMeta):8"""A base class for handling installable artifacts.910The requirements for anything installable are as follows:1112- we must be able to determine the requirement name13(or we can't correctly handle the non-upgrade case).1415- for packages with setup requirements, we must also be able16to determine their requirements without installing additional17packages (for the same reason as run-time dependencies)1819- we must be able to create a Distribution object exposing the20above metadata.21"""2223def __init__(self, req: InstallRequirement) -> None:24super().__init__()25self.req = req2627@abc.abstractmethod28def get_metadata_distribution(self) -> BaseDistribution:29raise NotImplementedError()3031@abc.abstractmethod32def prepare_distribution_metadata(33self,34finder: PackageFinder,35build_isolation: bool,36check_build_deps: bool,37) -> None:38raise NotImplementedError()394041