installed.py 680 B

1234567891011121314151617181920
  1. from pip._internal.distributions.base import AbstractDistribution
  2. from pip._internal.index.package_finder import PackageFinder
  3. from pip._internal.metadata import BaseDistribution
  4. class InstalledDistribution(AbstractDistribution):
  5. """Represents an installed package.
  6. This does not need any preparation as the required information has already
  7. been computed.
  8. """
  9. def get_metadata_distribution(self) -> BaseDistribution:
  10. assert self.req.satisfied_by is not None, "not actually installed"
  11. return self.req.satisfied_by
  12. def prepare_distribution_metadata(
  13. self, finder: PackageFinder, build_isolation: bool
  14. ) -> None:
  15. pass