installed.py 645 B

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