You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

123456789101112131415161718192021222324252627282930313233343536
  1. # The following comment should be removed at some point in the future.
  2. # mypy: disallow-untyped-defs=False
  3. import abc
  4. from pip._vendor.six import add_metaclass
  5. @add_metaclass(abc.ABCMeta)
  6. class AbstractDistribution(object):
  7. """A base class for handling installable artifacts.
  8. The requirements for anything installable are as follows:
  9. - we must be able to determine the requirement name
  10. (or we can't correctly handle the non-upgrade case).
  11. - for packages with setup requirements, we must also be able
  12. to determine their requirements without installing additional
  13. packages (for the same reason as run-time dependencies)
  14. - we must be able to create a Distribution object exposing the
  15. above metadata.
  16. """
  17. def __init__(self, req):
  18. super(AbstractDistribution, self).__init__()
  19. self.req = req
  20. @abc.abstractmethod
  21. def get_pkg_resources_distribution(self):
  22. raise NotImplementedError()
  23. @abc.abstractmethod
  24. def prepare_distribution_metadata(self, finder, build_isolation):
  25. raise NotImplementedError()