installed.py 729 B

1234567891011121314151617181920212223
  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,
  14. finder: PackageFinder,
  15. build_isolation: bool,
  16. check_build_deps: bool,
  17. ) -> None:
  18. pass