installed.py 667 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):
  11. # type: () -> Optional[Distribution]
  12. return self.req.satisfied_by
  13. def prepare_distribution_metadata(self, finder, build_isolation):
  14. # type: (PackageFinder, bool) -> None
  15. pass