entrypoints.py 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. import sys
  2. from pip._internal.cli.main import main
  3. from pip._internal.utils.typing import MYPY_CHECK_RUNNING
  4. if MYPY_CHECK_RUNNING:
  5. from typing import Optional, List
  6. def _wrapper(args=None):
  7. # type: (Optional[List[str]]) -> int
  8. """Central wrapper for all old entrypoints.
  9. Historically pip has had several entrypoints defined. Because of issues
  10. arising from PATH, sys.path, multiple Pythons, their interactions, and most
  11. of them having a pip installed, users suffer every time an entrypoint gets
  12. moved.
  13. To alleviate this pain, and provide a mechanism for warning users and
  14. directing them to an appropriate place for help, we now define all of
  15. our old entrypoints as wrappers for the current one.
  16. """
  17. sys.stderr.write(
  18. "WARNING: pip is being invoked by an old script wrapper. This will "
  19. "fail in a future version of pip.\n"
  20. "Please see https://github.com/pypa/pip/issues/5599 for advice on "
  21. "fixing the underlying issue.\n"
  22. "To avoid this problem you can invoke Python with '-m pip' instead of "
  23. "running pip directly.\n"
  24. )
  25. return main(args)