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#dZme e dd"dd$d(d)dd#dZne e/dd"dLd@dLd$dd#dZoddZpe e dd"dd$d(d)dd#dZqe e dd"ddKdd$dd)gdBdgd#e Zre e dd"ddKdd$dd)gdBddgd#dZse e dd"ddKdd$dd)gdBgd#dZtddde0e1e2e3e5e6e;e<e=e>e?e@eHeAeBe\e^eke4eqeresetgiZudddeDeEeFeGgiZvdS)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. )absolute_importN) strtobool)partial) SUPPRESS_HELPOption OptionGroup)dedent) BAR_TYPES) CommandError)USER_CACHE_DIRget_src_prefix) FormatControl)PyPI) TargetPython) STRONG_HASHES)MYPY_CHECK_RUNNING)AnyCallableDictOptionalTuple) OptionParserValues)ConfigOptionParsercCsAdj||}tjdj|j}|j|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)formattextwrapfilljoinspliterror)parseroptionmsgr$/builddir/build/BUILDROOT/alt-python35-pip-20.2.4-5.el8.x86_64/opt/alt/python35/lib/python3.5/site-packages/pip/_internal/cli/cmdoptions.pyraise_option_error&s r&cCs<t||d}x"|dD]}|j|qW|S)z Return an OptionGroup object group -- assumed to be dict with 'name' and 'options' keys parser -- an optparse Parser nameoptions)r add_option)groupr! option_groupr"r$r$r%make_option_group5sr,csrdkr|fdd}dddg}tt||rn|j}|jtjddd dS) 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. Ncst|dS)N)getattr)n) check_optionsr$r%getnameMsz+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)anymapformat_controldisallow_binarieswarningswarn)r(r/r0namescontrolr$)r/r%check_install_build_globalBs   r>FcCst|j|j|j|jg}ttdh}|j|koO|j }|rj|rjt d|r|r|j rt 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) r6python_versionplatformabiimplementationr setr8ignore_dependenciesr target_dir)r( check_targetdist_restriction_set binary_onlysdist_dependencies_allowedr$r$r%check_dist_restrictionZs   rJcCstjj|S)N)ospath expanduser)r"optvaluer$r$r%_path_option_checksrPc@s6eZdZejdZejjZeed/src". The default for global installs is "/src".cCst||jS)zGet a format_control object.)r-rX)rr"r$r$r%_get_format_controlsrcCs/t|j|}tj||j|jdS)N)rrr handle_mutual_excludes no_binary only_binary)r"rrOr!existingr$r$r%_handle_no_binarysrcCs/t|j|}tj||j|jdS)N)rrr rrr)r"rrOr!rr$r$r%_handle_only_binarysrcCsCttt}tddddddtddd|d d S) Nz --no-binaryrXr8rZrrernr]rYavDo 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 rCrr)r8r$r$r%rs  rcCsCttt}tddddddtddd|d d S) Nz --only-binaryrXr8rZrrernr]rYaKDo 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 rCrr)r8r$r$r%rs  rz --platformr@z[Only use wheels compatible with . Defaults to the platform of the running system.c Cs|s d S|jd}t|dkr5fdfSt|dkr}|d}t|dkr}|d|ddg}ytdd|D}Wntk rfd fSYnX|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. N.z'at most three version parts are allowedrcss|]}t|VqdS)N)rq).0partr$r$r% sz*_convert_python_version..z$each version part must be an integer)NN)rlentuple ValueError)rOparts version_infor$r$r%_convert_python_versions   rcCsVt|\}}|dk rFdj||}t|d|d|||j_dS)z3 Handle a provided --python-version value. Nz(invalid --python-version value: {!r}: {}r"r#)rrr&rr?)r"rrOr!r error_msgr#r$r$r%_handle_python_versions   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). z--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--abirAzOnly use wheels compatible with Python abi , e.g. 'pypy_41'. If not specified, then the current interpreter abi tag is used. Generally you will need to specify --implementation, --platform, and --python-version when using this option.cCsD|jt|jt|jt|jtdS)N)r)r@r?rBrA)cmd_optsr$r$r%add_target_python_optionsVsrc Cs1td|jd|jd|jd|j}|S)Nr@py_version_inforArB)rr@r?rArB)r( target_pythonr$r$r%make_target_python^s     rc Cs"tddddddddd S) Nz--prefer-binaryrX prefer_binaryrZr\r]FrYz8Prefer older binary packages over newer source packages.)rr$r$r$r%rjs rz --cache-dir cache_dirzStore the cache data in .cCsn|dk r^yt|WnAtk r]}z!t|d|dt|WYdd}~XnXd|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. Nr"r#F)rrr&rnrr)r"rNrOr!excr$r$r%_handle_no_cache_dirs / rz--no-cache-dirzDisable the cache.z --no-depsz--no-dependenciesrDz#Don't install package dependencies.cCs2|rtjj|}t|j|j|dS)N)rKrLrrrrX)r"rNrOr!r$r$r%_handle_build_dirsrz-bz--buildz --build-dirz--build-directory build_diraK(DEPRECATED) Directory to unpack packages into and build in. Note that an initial build still takes place in a temporary directory. The location of temporary directories can be controlled by setting the TMPDIR environment variable (TEMP on Windows) appropriately. When passed, build directories are not cleaned in case of failures.z--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.cCs8|dk r(d}t|d|d|d|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"r#F)r&r use_pep517)r"rNrOr!r#r$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-pep517z--install-optionr3r}r(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.z--global-optionr2zTExtra global options to be supplied to the setup.py call before the install command.z --no-cleanz!Don't clean up build directories.z--prezYInclude pre-release and development versions. By default, pip only finds stable versions.z--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.c Cs|jjsi|j_y|jdd\}}Wn(tk r^|jdj|YnX|tkr|jdj|djt|jjj|gj |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) rhashesrrr rrr setdefaultr})r"rrOr!algodigestr$r$r%_handle_merge_hash9s      rz--hashrstringzgVerify that the package's archive matches this hash before installing. Example: --hash=sha256:abcdef...z--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).cCs+|jr'|js|jr'tddS)Nz2Cannot combine '--path' with '--user' or '--local')rLuserlocalr )r(r$r$r%check_list_path_optionpsrz--no-python-version-warningno_python_version_warningz>Silence deprecation warnings for upcoming unsupported Pythons.z--unstable-featureunstable_featuresfeatureresolverz --use-featurefeatures_enabledz 2020-resolverz fast-depszrJrPrQhelp_r[require_virtualenvr_rarbrclistkeysrrdrjrlrmrprtrwr~r simple_urlrrrrrrrrrsrcrrrrrr@rrr?rBrArrrrrno_cacheno_depsrrrno_build_isolationrr no_use_pep517r3r2no_cleanprerrhashr list_pathrrunstable_featureuse_new_featureuse_deprecated_feature general_group index_groupr$r$r$r%s    (  (