"""A single place for constructing and exposing the main parser
"""
=
"""Creates and returns the main parser for pip's CLI"""
=
=
# add the general options
=
# so the help formatter knows
= True # type: ignore
# create command listing for description
= +
=
return
# If the named file exists, use it.
# If it's a directory, assume it's a virtual environment and
# look for the environment's Python executable.
# bin/python for Unix, Scripts/python.exe for Windows
# Try both in case of odd cases like cygwin.
=
return
return
# Could not find the interpreter specified
return None
=
# Note: parser calls disable_interspersed_args(), so the result of this
# call is to split the initial args into the general options before the
# subcommand and everything else.
# For example:
# args: ['--timeout=5', 'install', '--user', 'INITools']
# general_options: ['--timeout==5']
# args_else: ['install', '--user', 'INITools']
, =
# --python
# Re-invoke pip using the specified Python interpreter
=
=
# Set a flag so the child doesn't re-invoke itself, causing
# an infinite loop.
=
= 0
=
=
# --version
# pip || pip help -> print_help()
# the subcommand name
=
=
=
# all the args without the subcommand
=
return ,