a Ran@s2 UdZddlZddlZddlZddlmZddlmZmZm Z m Z m Z ddlm Z ddl mZmZmZmZmZddlmZddlmZdd lmZdd lmZdd lmZmZdd lmZdd l m!Z!ddl"m#Z#ddl$m%Z%ddl&m'Z'e ee(ddddZ)ee(efee dddZ*d(e ee ddddZ+d)e e,ddddZ-ee(e(e(ddd Z.ee(e(e(dd!d"Z/Gd#d$d$eZ0eed%d&d'd'd(d)Z1ed*efe2d+<eed,d-d.dd/d0Z3ed*efe2d-<eed1d2d.dd3d0Z4ed*efe2d2<eed4d5d6d.ded0Z5ed*efe2d7<eed8d9d:d;ddd.dd?d0Z7ed*efe2d><eed@dAdBd.dCd)Z8ed*efe2dB<eedDdEdFd;ddGd0Z9ed*efe2dF<eedHdIdJe:e;dKdLdMed*efe2dS<eedWdXd.ddYd0Z?ed*efe2dX<eedZd[d\d]d^d_Z@ed*efe2d[<eed`dadbdcddd_ZAed*efe2da<eededfdgdhdidjdkdlZBed*efe2dh<edmdndoZCee0dpdqdTdTdrdsZDed*efe2dq<ee0dtdudTddTdvdwZEed*efe2du<eedxdydzd{d|e!jFd}d~ZGed*efe2d{<edmddZHeeddd.ddd0ZIed*efe2d<edmddZJedmddZKedmddZLedmddZMedmddZNee(e(e ddddZOee0ddddddTdedeOdd ZPed*efe2d<e eedddZQee(e(e ddddZRee(e(e ddddZSedmddZTedmddZUeedddddddZVed*efe2d<e(eeeWd*fee(fdddZXee(e(e ddddZYeeddddeYd\de dd ZZed*efe2d<eedddddd~Z[ed*efe2d<eedddddddZ\ed*efe2d<e ddddZ]e e#dddZ^edmddÄZ_ee0ddeddTddǍZ`ed*efe2d<ee(e(e ddȜddʄZaeedddeadd͍Zbed*efe2d<eedddd.ddd0Zced*efe2d<eeddd.dd)Zded*efe2d<eedddddd0Zeed*efe2d<ee(e(e ddȜddބZfeeddd.ddd0Zgee2d<eedddefdedZhee2d<eeddddddZied*efe2d<eeddddddZjed*efe2d<eeddddddZked*efe2d<eedd.dddZled*efe2d<eedd.dddZmed*efe2d<eeddd.ddd0Zned*efe2d<ee(e(e ddddZoeedddeodddZped*efe2d<eeddd.ddd0Zqed*efe2d<ee0ddTdTdddZred*efe2d <e ddd d Zsee0d d dddddZted*efe2d<eeddd.ddd0Zued*efe2d<eeddddggdddZved*efe2d<eeddddgdd gd!dZwed*efe2d"<d#e1e3e4e5e6e8e9e>e?e@eAeBeCeKeDeEe`ebene7euevewgd$Zxee(efe2d%<d&eGeHeIeJgd$Zyee(efe2d'<dS(*aC 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) BAR_TYPES) 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)textwrapZfilljoinspliterror)rrrr#M/opt/alt/python39/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&rZ option_grouprr#r#r$make_option_group0s r*)r( check_optionsrcsZdur |tttdfdd }gd}tt||rV|j}|tjddddS) zDisable wheels if per-setup.py call options are set. :param options: The OptionParser options to update. :param check_options: The options to check, if not supplied defaults to options. N)nrcs t|dSN)getattr)r,r+r#r$getnameHsz+check_install_build_global..getname) build_optionsglobal_optionsinstall_optionszbDisabling all use of wheels due to the use of --build-option / --global-option / --install-option.) stacklevel) strr r anymapformat_controlZdisallow_binarieswarningswarn)r(r+r0namesZcontrolr#r/r$check_install_build_global<s r=F)r( check_targetrcCsbt|j|j|j|jg}ttdh}|j|ko6|j }|rH|rHt d|r^|r^|j s^t 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:).zQCan not use any platform or abi specific options unless installing via '--target'N) r7python_version platformsabisimplementationrsetr9ignore_dependenciesrZ target_dir)r(r>Zdist_restriction_setZ binary_onlyZsdist_dependencies_allowedr#r#r$check_dist_restrictionVs&  rE)roptvaluercCs tj|Sr-)ospath expanduserrrFrGr#r#r$_path_option_check~srLcCst|Sr-rrKr#r#r$_package_name_option_checksrMc@s0eZdZejdZejZeed<eed<dS) PipOption)rI package_namerOrIN) __name__ __module__ __qualname__rZTYPESZ TYPE_CHECKERcopyrMrLr#r#r#r$rNs  rNz-hz--helphelpz Show help.)destactionrT.help_z--debug debug_mode store_truezbLet unhandled exceptions propagate outside the main subroutine, instead of logging them to stderr.rUrVdefaultrTz --isolated isolated_modezSRun pip in an isolated mode, ignoring environment variables and user configuration.z--require-virtualenvz--require-venvZ require_venvrequire_virtualenvz-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_barchoiceZonz*Specify type of progress to be displayed [|z] (default: %default))rUtypechoicesr[rTz--logz --log-filez --local-loglogrIz Path to a verbose appending log.)rUmetavarrfrTz --no-inputno_inputzDisable prompting for input.z--proxyproxyr6z/src". The default for global installs is "/src".)rUrfrir[rVrrTsrc)rrrcCs t||jS)zGet a format_control object.)r.rU)rrr#r#r$_get_format_controlsrcCs"t|j|}t||j|jdSr-)rrrhandle_mutual_excludes no_binary only_binaryrrrGrZexistingr#r#r$_handle_no_binarys  rcCs"t|j|}t||j|jdSr-)rrrrrrrr#r#r$_handle_only_binarys  rc Cs$ttt}tdddtd|ddS)Nz --no-binaryr9rr6avDo 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.rUrVrrfr[rT)rrCrrr9r#r#r$rsrc Cs$ttt}tdddtd|ddS)Nz --only-binaryr9rr6aKDo 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)rrCrrrr#r#r$rsrz --platformr@platformryzOnly 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)rGrcCs|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-)rn).0partr#r#r$ 8z*_convert_python_version..)r#z$each version part must be an integer)r!lentuple ValueError)rGparts version_infor#r#r$_convert_python_version"s     rcCs:t|\}}|dur.d||}t|||d||j_dS)z3 Handle a provided --python-version value. Nz(invalid --python-version value: {!r}: {}rr)rformatr%rr?)rrrGrrZ error_msgrr#r#r$_handle_python_version?s 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). )rUrirVrrfr[rTz--implementationrBzOnly 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--abirAZabiaLOnly 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?rBrA)rr#r#r$add_target_python_optionss   r)r(rcCst|j|j|j|jd}|S)N)r@Zpy_version_inforArB)rr@r?rArB)r(Z target_pythonr#r#r$make_target_pythonsrcCstddddddS)Nz--prefer-binary prefer_binaryrYFz8Prefer older binary packages over newer source packages.rZrzr#r#r#r$rsrz --cache-dir cache_dirzStore the cache data in .)rUr[rirfrT)rrFrGrrc 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%r6rr)rrFrGrexcr#r#r$_handle_no_cache_dirs  ( rz--no-cache-dirzDisable the cache.)rUrVrrTno_cachez --no-depsz--no-dependenciesrDz#Don't install package dependencies.no_depsz--ignore-requires-pythonignore_requires_pythonz'Ignore the Requires-Python information.z--no-build-isolationZbuild_isolationZ 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_isolationcCs&|durd}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. rF)r%r use_pep517)rrFrGrrr#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)rUrVrr[rT no_use_pep517z--install-optionr3r(a"Extra arguments to be supplied to the setup.py install command (use like --install-option="--install-scripts=/usr/local/bin"). Use multiple --install-option options to pass multiple options to setup.py install. If you are using an option with a directory path, be sure to use absolute path.)rUrVrirTz--build-optionr1z9Extra arguments to be supplied to 'setup.py bdist_wheel'.)rUrirVrTz--global-optionr2zcExtra global options to be supplied to the setup.py call before the install or bdist_wheel command.z --no-cleanz!Don't clean up build directories.)rVr[rTno_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.cCs|jjsi|j_z|dd\}}Wn"tyF|d|Yn0|tvrh|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.:rzTArguments to {} must be a hash name followed by a value, like --hash=sha256:abcde...z&Allowed hash algorithms for {} are {}.z, N) rhashesr!rr"rrr setdefaultry)rrrGrZalgoZdigestr#r#r$_handle_merge_hash[s"   rz--hashrstringzgVerify that the package's archive matches this hash before installing. Example: --hash=sha256:abcdef...)rUrVrrfrThashz--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).)rUrfrVrT list_pathcCs|jr|js|jrtddS)Nz2Cannot combine '--path' with '--user' or '--local')rIuserZlocalr)r(r#r#r$check_list_path_optionsrz --excludeZexcludespackagerOz)Exclude specified package from the output)rUrVrirfrT list_excludez--no-python-version-warningno_python_version_warningz>Silence deprecation warnings for upcoming unsupported Pythons.z --use-featureZfeatures_enabledZfeature)z 2020-resolverz fast-depsz in-tree-buildzs              (                       $