__main__.py 610 B

12345678910111213141516171819
  1. from __future__ import absolute_import
  2. import os
  3. import sys
  4. # If we are running from a wheel, add the wheel to sys.path
  5. # This allows the usage python pip-*.whl/pip install pip-*.whl
  6. if __package__ == '':
  7. # __file__ is pip-*.whl/pip/__main__.py
  8. # first dirname call strips of '/__main__.py', second strips off '/pip'
  9. # Resulting path is the name of the wheel itself
  10. # Add that to sys.path so we can import pip
  11. path = os.path.dirname(os.path.dirname(__file__))
  12. sys.path.insert(0, path)
  13. from pip._internal import main as _main # noqa
  14. if __name__ == '__main__':
  15. sys.exit(_main())