a *egu@s" UdZddlZddlZddlZddlZddlmZddlm Z m Z m Z m Z m Z ddlmZddlmZmZmZmZmZddlmZddlmZdd lmZdd lmZmZdd lmZdd l m!Z!dd l"m#Z#ddl$m%Z%ddl&m'Z'e(e)Z*e e e+ddddZ,ee+efee dddZ-dAe e.ddddZ/e e+e+e+dddZ0e e+e+e+dddZ1Gdd d e Z2ee d!d"d#d#d$d%Z3ed&e fe4d'<ee d(d)d*dd+d,Z5ed&e fe4d)<ee d-d.d*dd/d,Z6ed&e fe4d.<ee d0d1d2d*dd3d,Z7ed&e fe4d4<ee d5d6d*d7d%Z8ed&e fe4d6<ee d8d9d:d;Z9ed&e fe4d9<ee dd?dd@d,Z:ed&e fe4d><ee dAdBd*ddCd,Z;ed&e fe4dB<ee dDdEdFd*dGd%Zed&e fe4dM<ee2dSdTdUdVdWdWdXdYZ?ed&e fe4dV<ee dZd[d*dd\d,Z@ed&e fe4d[<ee d]d^gd_d`dadbZAed&e fe4d^<ee dcdddedfdgdhZBed&e fe4dd<ee didjdkdldmdhZCed&e fe4dj<ee dndodpdqdrdsdtduZDed&e fe4dq<e dvdwdxZEee2dydzdWdWd{d|ZFed&e fe4dz<ee2d}d~dWddWddZGed&e fe4d~<ee ddddde!jHddZIed&e fe4d<e dvddZJee ddd*ddd,ZKed&e fe4d<e dvddZLe dvddZMe dvddZNe dvddZOe dvddZPe e+e+e ddddZQee2ddddddWdedeQdd ZRed&e fe4d<e e edddZSe e+e+e ddddZTe e+e+e ddddZUe dvddZVe dvddZWee dddddddZXed&e fe4d<e+eeeYd&fee+fdddZZe e+e+e ddddZ[ee dddde[dededd Z\ed&e fe4d<ee ddddddZ]ed&e fe4d<ee dddddddZ^ed&e fe4d<e ddŜddDŽZ_e e#dȜddʄZ`e dvdd̄Zaee2ddeddWddЍZbed&e fe4d<e e+e+e ddќddӄZcee dddecdd֍Zded&e fe4d<ee dddd*ddd,Zeed&e fe4d<ee ddd*dd%Zfed&e fe4d<ee dddddd,Zged&e fe4d<ee ddd*ddd,Zhed&e fe4d<e e+e+e ddќddZiee ddd*ddd,Zjee4d<ee dddeide dZkee4d<e e+e+e ddddZlee ddde+delddd Zmed&e fe4d<ee ddddddZned&e fe4d<ee ddddddZoed&e fe4d<ee dd*dddZped&e fe4d<ee dd*dddZqed&e fe4d<ee d d d*dd d,Zred&e fe4d <ee d d dddgddZsed&e fe4d <e e+e+e ddddZtee dddetdddZued&e fe4d<ee ddd*ddd,Zved&e fe4d<ee2ddWdWdddZwed&e fe4d <e ddȜd!d"Zxee2d#d$dd%d&d'd(Zyed&e fe4d)<ee d*d+d*dd,d,Zzed&e fe4d+<d-d.gZ{ee d/d0d1dgd2ge{d3d4Z|ed&e fe4d5<ee d6d7d1dgd8d9gd:d4Z}ed&e fe4d;<d<d?eIeJeKeLgd=Zee+efe4d@<dS(BaC shared options and groups The principle here is to define options once, but *not* instantiate them globally. One reason being that options with action='append' can carry state between parses. pip parses general options twice internally, and shouldn't pass on state. To be consistent, all options will follow this design. N)partial) SUPPRESS_HELPOption OptionGroup OptionParserValues)dedent)AnyCallableDictOptionalTuplecanonicalize_name)ConfigOptionParser) CommandError)USER_CACHE_DIRget_src_prefix) FormatControl)PyPI) TargetPython) STRONG_HASHES) strtobool)parseroptionmsgreturncCs0|d|}td|}||dS)z Raise an option parsing error using parser.error(). Args: parser: an OptionParser instance. option: an Option instance. msg: the error text. z error:  N)textwrapfilljoinspliterror)rrrr#F/usr/local/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.pyraise_option_error$s r%)grouprrcCs,t||d}|dD]}||q|S)z Return an OptionGroup object group -- assumed to be dict with 'name' and 'options' keys parser -- an optparse Parser nameoptions)r add_option)r&r option_grouprr#r#r$make_option_group2s r+F)r( check_targetrcCsht|j|j|j|jg}ttdh}|j|ko6|j }|rH|rHt d|rd|j sd|rd|j sdt ddS)zFunction for determining if custom platform options are allowed. :param options: The OptionParser options. :param check_target: Whether or not to check if --target is being used. z:all:zWhen restricting platform and interpreter constraints using --python-version, --platform, --abi, or --implementation, either --no-deps must be set, or --only-binary=:all: must be set and --no-binary must not be set (or must be set to :none:).zfCan not use any platform or abi specific options unless installing via '--target' or using '--dry-run'N) anypython_version platformsabisimplementationrsetformat_controlignore_dependenciesrdry_run target_dir)r(r,dist_restriction_set binary_onlysdist_dependencies_allowedr#r#r$check_dist_restriction>s& r:)roptvaluercCs tj|SN)ospath expanduserrr;r<r#r#r$_path_option_checkfsrBcCst|Sr=rrAr#r#r$_package_name_option_checkjsrCc@s0eZdZejdZejZeed<eed<dS) PipOption)r? package_namerEr?N) __name__ __module__ __qualname__rTYPES TYPE_CHECKERcopyrCrBr#r#r#r$rDns  rDz-hz--helphelpz Show help.)destactionrL.help_z--debug debug_mode store_truezbLet unhandled exceptions propagate outside the main subroutine, instead of logging them to stderr.rMrNdefaultrLz --isolated isolated_modezSRun pip in an isolated mode, ignoring environment variables and user configuration.z--require-virtualenvz--require-venv require_venvzMAllow pip to only run in a virtual environment; exit with an error otherwise.require_virtualenvz--break-system-packagesoverride_externally_managedz=Allow pip to modify an EXTERNALLY-MANAGED Python installationz--pythonpythonz.Run pip with the specified Python interpreter.)rMrLz-vz --verboseverbosecountzDGive more output. Option is additive, and can be used up to 3 times.z --no-colorno_colorzSuppress colored output.z-Vz --versionversionzShow version and exit.z-qz--quietquietzGive less output. Option is additive, and can be used up to 3 times (corresponding to WARNING, ERROR, and CRITICAL logging levels).z--progress-bar progress_barchoice)onoffrawr`zLSpecify whether the progress bar should be used [on, off, raw] (default: on))rMtypechoicesrSrLz--logz --log-filez --local-loglogr?z Path to a verbose appending log.)rMmetavarrcrLz --no-inputno_inputzDisable prompting for input.z--keyring-providerkeyring_provider)autodisabledimport subprocessrizEnable the credential lookup via the keyring library if user input is allowed. Specify which mechanism to use [disabled, import, subprocess]. (default: disabled))rMrdrSrLz--proxyproxystrzESpecify a proxy in the form scheme://[user:passwd@]proxy.server:port.)rMrcrSrLz --retriesretriesintzRMaximum number of retries each connection should attempt (default %default times).z --timeoutz--default-timeoutsectimeoutfloatz2Set the socket timeout (default %default seconds).)rfrMrcrSrL)rc CstdddgdgddddS) Nz--exists-action exists_actionr_)siwbaappendrNzYDefault action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.)rMrcrdrSrNrfrLrr#r#r#r$rw+srwz--certcertzPath to PEM-encoded CA certificate bundle. If provided, overrides the default. See 'SSL Certificate Verification' in pip documentation for more information.)rMrcrfrLz --client-cert client_certzkPath to SSL client certificate, a single file containing the private key and the certificate in PEM format.)rMrcrSrfrLz-iz --index-urlz --pypi-url index_urlURLzBase URL of the Python Package Index (default %default). This should point to a repository compliant with PEP 503 (the simple repository API) or a local directory laid out in the same format.)rMrfrSrLcCstddddgddS)Nz--extra-index-urlextra_index_urlsrr}zmExtra URLs of package indexes to use in addition to --index-url. Should follow the same rules as --index-url.rMrfrNrSrLr~r#r#r#r$extra_index_urlbsrz --no-indexno_indexzAIgnore package index (only looking at --find-links URLs instead).c CstddddgdddS)Nz-fz --find-links find_linksr}urlaIf a URL or path to an html file, then parse for links to archives such as sdist (.tar.gz) or wheel (.whl) files. If a local path or file:// URL that's a directory, then look for archives in the directory listing. Links to VCS project URLs are not supported.rMrNrSrfrLr~r#r#r#r$rysrcCstddddgddS)Nz--trusted-host trusted_hostsr}HOSTNAMEz]Mark this host or host:port pair as trusted, even though it does not have valid or any HTTPS.)rMrNrfrSrLr~r#r#r#r$ trusted_hostsrc CstddddgdddS)Nz-cz --constraint constraintsr}filez\Constrain versions using the given constraints file. This option can be used multiple times.rr~r#r#r#r$rsrc CstddddgdddS)Nz-rz --requirement requirementsr}rzQInstall from the given requirements file. This option can be used multiple times.rr~r#r#r#r$rsrc CstddddgdddS)Nz-ez --editable editablesr}zpath/urlzkInstall a project in editable mode (i.e. setuptools "develop mode") from a local project path or a VCS url.rr~r#r#r#r$editablesr)ropt_strr<rrcCs tj|}t|j|j|dSr=)r>r?abspathsetattrvaluesrM)rrr<rr#r#r$ _handle_srcs rz--srcz--sourcez --source-dirz--source-directorysrc_dirdircallbackzDirectory to check out editable projects into. The default in a virtualenv is "/src". The default for global installs is "/src".)rMrcrfrSrNrrLsrc)rrrcCs t||jS)zGet a format_control object.)getattrrM)rrr#r#r$_get_format_controlsrcCs"t|j|}t||j|jdSr=)rrrhandle_mutual_excludes no_binary only_binaryrrr<rexistingr#r#r$_handle_no_binarys  rcCs"t|j|}t||j|jdSr=)rrrrrrrr#r#r$_handle_only_binarys  rc Cs$ttt}tdddtd|ddS)Nz --no-binaryr3rrnavDo not use binary packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either ":all:" to disable all binary packages, ":none:" to empty the set (notice the colons), or one or more package names with commas between them (no colons). Note that some packages are tricky to compile and may fail to install when this option is used on them.rMrNrrcrSrL)rr2rrr3r#r#r$rsrc Cs$ttt}tdddtd|ddS)Nz --only-binaryr3rrnaKDo not use source packages. Can be supplied multiple times, and each time adds to the existing value. Accepts either ":all:" to disable all source packages, ":none:" to empty the set, or one or more package names with commas between them. Packages without binary distributions will fail to install when this option is used on them.r)rr2rrrr#r#r$rsrz --platformr/platformr}zOnly use wheels compatible with . Defaults to the platform of the running system. Use this option multiple times to specify multiple platforms supported by the target interpreter.r)r<rcCs|sdS|d}t|dkr"dSt|dkrV|d}t|dkrV|d|ddg}ztdd |D}WntyYd S0|dfS) z Convert a version string like "3", "37", or "3.7.3" into a tuple of ints. :return: A 2-tuple (version_info, error_msg), where `error_msg` is non-None if and only if there was a parsing error. )NN.)r#z'at most three version parts are allowedrNcss|]}t|VqdSr=)rq).0partr#r#r$ :z*_convert_python_version..)r#z$each version part must be an integer)r!lentuple ValueError)r<parts version_infor#r#r$_convert_python_version$s     rcCs>t|\}}|dur2d|d|}t|||d||j_dS)z3 Handle a provided --python-version value. Nz invalid --python-version value: z: rr)rr%rr.)rrr<rr error_msgrr#r#r$_handle_python_versionAs  rz--python-versionr.a The Python interpreter version to use for wheel and "Requires-Python" compatibility checks. Defaults to a version derived from the running interpreter. The version can be specified using up to three dot-separated integers (e.g. "3" for 3.0.0, "3.7" for 3.7.0, or "3.7.3"). A major-minor version can also be given as a string without dots (e.g. "37" for 3.7.0). )rMrfrNrrcrSrLz--implementationr1zOnly use wheels compatible with Python implementation , e.g. 'pp', 'jy', 'cp', or 'ip'. If not specified, then the current interpreter implementation is used. Use 'py' to force implementation-agnostic wheels.z--abir0abiaLOnly use wheels compatible with Python abi , e.g. 'pypy_41'. If not specified, then the current interpreter abi tag is used. Use this option multiple times to specify multiple abis supported by the target interpreter. Generally you will need to specify --implementation, --platform, and --python-version when using this option.)cmd_optsrcCs4|t|t|t|tdSr=)r)r/r.r1r0)rr#r#r$add_target_python_optionss   r)r(rcCst|j|j|j|jd}|S)N)r/py_version_infor0r1)rr/r.r0r1)r( target_pythonr#r#r$make_target_pythonsrcCstddddddS)Nz--prefer-binary prefer_binaryrQFzSPrefer binary packages over source packages, even if the source packages are newer.rRr~r#r#r#r$rsrz --cache-dir cache_dirzStore the cache data in .)rMrSrfrcrL)rr;r<rrc CsX|durLz t|Wn6tyJ}zt||t|dWYd}~n d}~00d|j_dS)z Process a value provided for the --no-cache-dir option. This is an optparse.Option callback for the --no-cache-dir option. NrF)rrr%rnrr)rr;r<rexcr#r#r$_handle_no_cache_dirs  ( rz--no-cache-dirzDisable the cache.)rMrNrrLno_cachez --no-depsz--no-dependenciesr4z#Don't install package dependencies.no_depsz--ignore-requires-pythonignore_requires_pythonz'Ignore the Requires-Python information.z--no-build-isolationbuild_isolation store_falseTzDisable isolation when building a modern source distribution. Build dependencies specified by PEP 518 must be already installed if this option is used.no_build_isolationz--check-build-dependenciescheck_build_depsz1Check the build dependencies when PEP517 is used.cCs\|durd}t|||dd}tdd|DsPdd|d }t|||dd |j_dS) z Process a value provided for the --no-use-pep517 option. This is an optparse.Option callback for the no_use_pep517 option. Na0A value was passed for --no-use-pep517, probably using either the PIP_NO_USE_PEP517 environment variable or the "no-use-pep517" config file option. Use an appropriate value of the PIP_USE_PEP517 environment variable or the "use-pep517" config file option instead. r) setuptoolswheelcss|]}tj|VqdSr=) importlibutil find_spec)rpackager#r#r$rrz(_handle_no_use_pep517..z2It is not possible to use --no-use-pep517 without z and z installed.F)r%allr r use_pep517)rr;r<rrpackagesr#r#r$_handle_no_use_pep517s rz --use-pep517rz^Use PEP 517 for building source distributions (use --no-use-pep517 to force legacy behaviour).z--no-use-pep517)rMrNrrSrL no_use_pep517cCs|d\}}}|dkr*|d|dt|j|j}|durTi}t|j|j|||vrt||trz|||q|||g||<n|||<dS)N= Arguments to z must be of the form KEY=VAL) partitionr"rrrMr isinstancelistr})rrr<rkeysepvalrMr#r#r$_handle_config_settings5srz-Cz--config-settingsconfig_settingssettingszConfiguration settings to be passed to the PEP 517 build backend. Settings take the form KEY=VALUE. Use multiple --config-settings options to pass multiple keys to the backend.)rMrcrNrrfrLz--build-option build_optionsr(z9Extra arguments to be supplied to 'setup.py bdist_wheel'.)rMrfrNrLz--global-optionglobal_optionszcExtra global options to be supplied to the setup.py call before the install or bdist_wheel command.)rMrNrfrLz --no-cleanz!Don't clean up build directories.)rNrSrLno_cleanz--prezYInclude pre-release and development versions. By default, pip only finds stable versions.prez--disable-pip-version-checkdisable_pip_version_checkz{Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.z--root-user-actionroot_user_actionwarnignorezBAction if pip is run as a root user [warn, ignore] (default: warn))rMrSrdrLcCs|jjsi|j_z|dd\}}Wn$tyH|d|dYn0|tvrj|d|dt|jj|g |dS)zkGiven a value spelled "algo:digest", append the digest to a list pointed to in a dict by the algo name.:rrzE must be a hash name followed by a value, like --hash=sha256:abcde...z&Allowed hash algorithms for {} are {}.z, N) rhashesr!rr"rformatr setdefaultr})rrr<ralgodigestr#r#r$_handle_merge_hashs   rz--hashrstringzgVerify that the package's archive matches this hash before installing. Example: --hash=sha256:abcdef...)rMrNrrcrLhashz--require-hashesrequire_hasheszRequire a hash to check each requirement against, for repeatable installs. This option is implied when any package in a requirements file has a --hash option.z--pathz^Restrict to the specified installation path for listing packages (can be used multiple times).)rMrcrNrL list_pathcCs|jr|js|jrtddS)Nz2Cannot combine '--path' with '--user' or '--local')r?userlocalr)r(r#r#r$check_list_path_optionsrz --excludeexcludesrrEz)Exclude specified package from the output)rMrNrfrcrL list_excludez--no-python-version-warningno_python_version_warningz>Silence deprecation warnings for upcoming unsupported Pythons.Z truststorezno-binary-enable-wheel-cachez --use-featurefeatures_enabledfeaturez fast-depszr functoolsroptparserrrrrrtypingr r r r r pip._vendor.packaging.utilsrpip._internal.cli.parserrpip._internal.exceptionsrpip._internal.locationsrr#pip._internal.models.format_controlrpip._internal.models.indexr"pip._internal.models.target_pythonrpip._internal.utils.hashesrpip._internal.utils.miscr getLoggerrFloggerrnr%r+boolr:rBrCrDrO__annotations__rPrTrVrWrXrYr[r\r]r^rergrhrmrprtrwrr simple_urlrrrrrrrrrrrrrrrr/rqrrr.r1r0rrrrrrrrrrrrrrrrrrrrrrrrrrrrZALWAYS_ENABLED_FEATURESrrrrr#r#r#r$s              (                       $          #