a Ren@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)textwrapfilljoinspliterror)rrrr$/builddir/build/BUILDROOT/alt-python39-pip-21.3.1-2.el8.x86_64/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'r 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_controldisallow_binarieswarningswarn)r)r-r2namescontrolr$r1r%check_install_build_global<s rAF)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) r9python_version platformsabisimplementationrsetr;ignore_dependenciesr target_dir)r)rBdist_restriction_set binary_onlysdist_dependencies_allowedr$r$r%check_dist_restrictionVs&  rM)roptvaluercCs tj|Sr/)ospath expanduserrrNrOr$r$r%_path_option_check~srTcCst|Sr/rrSr$r$r%_package_name_option_checksrUc@s0eZdZejdZejZeed<eed<dS) PipOption)rQ package_namerWrQN) __name__ __module__ __qualname__rTYPES TYPE_CHECKERcopyrUrTr$r$r$r%rVs  rVz-hz--helphelpz Show help.)destactionr^.help_z--debug debug_mode store_truezbLet unhandled exceptions propagate outside the main subroutine, instead of logging them to stderr.r_r`defaultr^z --isolated isolated_modezSRun pip in an isolated mode, ignoring environment variables and user configuration.z--require-virtualenvz--require-venv 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_barchoiceonz*Specify type of progress to be displayed [|z] (default: %default))r_typechoicesrer^z--logz --log-filez --local-loglogrQz Path to a verbose appending log.)r_metavarrrr^z --no-inputno_inputzDisable prompting for input.z--proxyproxyr8z/src". The default for global installs is "/src".)r_rrrurer`rr^src)rrrcCs t||jS)zGet a format_control object.)r0r_)rrr$r$r%_get_format_controlsrcCs"t|j|}t||j|jdSr/)rrrhandle_mutual_excludes no_binary only_binaryrrrOrexistingr$r$r%_handle_no_binarys  rcCs"t|j|}t||j|jdSr/)rrrrrrrr$r$r%_handle_only_binarys  rc Cs$ttt}tdddtd|ddS)Nz --no-binaryr;rr8avDo 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.r_r`rrrrer^)rrGrrr;r$r$r%rsrc Cs$ttt}tdddtd|ddS)Nz --only-binaryr;rr8aKDo 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)rrGrrrr$r$r%rsrz --platformrDplatformrzOnly 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)rOrcCs|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/)rz).0partr$r$r% 8z*_convert_python_version..)r$z$each version part must be an integer)r"lentuple ValueError)rOparts 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&rrC)rrrOrr error_msgrr$r$r%_handle_python_version?s rz--python-versionrCa 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). )r_rur`rrrrer^z--implementationrFzOnly 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--abirEabiaLOnly 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*rDrCrFrE)rr$r$r%add_target_python_optionss   r)r)rcCst|j|j|j|jd}|S)N)rDpy_version_inforErF)rrDrCrErF)r) target_pythonr$r$r%make_target_pythonsrcCstddddddS)Nz--prefer-binary prefer_binaryrcFz8Prefer older binary packages over newer source packages.rdrr$r$r$r%rsrz --cache-dir cache_dirzStore the cache data in .)r_rerurrr^)rrNrOrrc 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&r8rr)rrNrOrexcr$r$r%_handle_no_cache_dirs  ( rz--no-cache-dirzDisable the cache.)r_r`rr^no_cachez --no-depsz--no-dependenciesrHz#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_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)rrNrOrrr$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)r_r`rrer^ no_use_pep517z--install-optionr5r)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.)r_r`rur^z--build-optionr3z9Extra arguments to be supplied to 'setup.py bdist_wheel'.)r_rur`r^z--global-optionr4zcExtra 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.)r`rer^no_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! setdefaultr)rrrOralgodigestr$r$r%_handle_merge_hash[s"   rz--hashrstringzgVerify that the package's archive matches this hash before installing. Example: --hash=sha256:abcdef...)r_r`rrrr^hashz--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).)r_rrr`r^ list_pathcCs|jr|js|jrtddS)Nz2Cannot combine '--path' with '--user' or '--local')rQuserlocalr)r)r$r$r%check_list_path_optionsrz --excludeexcludespackagerWz)Exclude specified package from the output)r_r`rurrr^ list_excludez--no-python-version-warningno_python_version_warningz>Silence deprecation warnings for upcoming unsupported Pythons.z --use-featurefeatures_enabledfeature)z 2020-resolverz fast-depsz in-tree-buildzs              (                       $