Path: blob/main/test/lib/python3.9/site-packages/pip/__main__.py
4798 views
import os1import sys2import warnings34# Remove '' and current working directory from the first entry5# of sys.path, if present to avoid using current directory6# in pip commands check, freeze, install, list and show,7# when invoked as python -m pip <command>8if sys.path[0] in ("", os.getcwd()):9sys.path.pop(0)1011# If we are running from a wheel, add the wheel to sys.path12# This allows the usage python pip-*.whl/pip install pip-*.whl13if __package__ == "":14# __file__ is pip-*.whl/pip/__main__.py15# first dirname call strips of '/__main__.py', second strips off '/pip'16# Resulting path is the name of the wheel itself17# Add that to sys.path so we can import pip18path = os.path.dirname(os.path.dirname(__file__))19sys.path.insert(0, path)2021if __name__ == "__main__":22# Work around the error reported in #9540, pending a proper fix.23# Note: It is essential the warning filter is set *before* importing24# pip, as the deprecation happens at import time, not runtime.25warnings.filterwarnings(26"ignore", category=DeprecationWarning, module=".*packaging\\.version"27)28from pip._internal.cli.main import main as _main2930sys.exit(_main())313233