installed.py 760 B

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