o
    hmo                     @   s
  U d Z ddlZddlZddlZddlmZ ddlmZmZm	Z	m
Z
mZ ddlmZ ddlmZmZmZmZmZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZmZ ddlmZ ddl m!Z! ddl"m#Z# ddl$m%Z% ddl&m'Z' e(e)Z*de
dede+ddfddZ,dee+ef dede	fddZ-	d(dedee ddfddZ.d)dede/ddfd d!Z0ded"e+d#e+de+fd$d%Z1ded"e+d#e+de+fd&d'Z2G d(d) d)eZ3eed*d+d,d,d-d.Z4ed/ef e5d0< eed1d2d3dd4d5Z6ed/ef e5d2< eed6d7d3dd8d5Z7ed/ef e5d7< eed9d:d;d3dd<d5Z8ed/ef e5d=< eed>d?d@dAddBd5Z9ed/ef e5d@< eedCdDd3ddEd5Z:ed/ef e5dD< eedFdGdHd3dId.Z;ed/ef e5dH< eedJdKdLdAddMd5Z<ed/ef e5dL< eedNdOdPe=e> dQdRdS?e>  dT dUZ@ed/ef e5dO< ee3dVdWdXdYdZdZd[d\ZAed/ef e5dY< eed]d^d3dd_d5ZBed/ef e5d^< eed`dadbdcdddeZCed/ef e5da< eedfdgdhdidjdeZDed/ef e5dg< eedkdldmdndodpdqdrZEed/ef e5dn< defdsdtZFee3dudvdZdZdwdxZGed/ef e5dv< ee3dydzdZddZd{d|ZHed/ef e5dz< eed}d~ddde!jIddZJed/ef e5d< defddZKeeddd3ddd5ZLed/ef e5d< defddZMdefddZNdefddZOdefddZPdefddZQdede+d#e+de
ddf
ddZRee3ddddddZde deRddZSed/ef e5d< dededefddZTdede+d#e+de
ddf
ddZUdede+d#e+de
ddf
ddZVdefddZWdefddZXeedddddddZYed/ef e5d< d#e+deeeZd/f ee+ f fddZ[dede+d#e+de
ddf
ddZ\eedddde\dbdedd	Z]ed/ef e5d< eeddddddZ^ed/ef e5d< eedddddddZ_ed/ef e5d< de	ddfddZ`dede#fddĄZadefddƄZbee3ddeddZddʍZced/ef e5d< ded"e+d#e+de
ddf
dd̄ZdeedddedddύZeed/ef e5d< eedddd3ddd5Zfed/ef e5d< eeddd3dd.Zged/ef e5d< eedddddd5Zhed/ef e5d< ded"e+d#e+de
ddf
ddZieeddd3ddd5Zjee5d< eedddeidedZkee5d< eeddddddZled/ef e5d< eeddddddZmed/ef e5d< eeddddddZned/ef e5d< eedd3dddZoed/ef e5d< eedd3dddZped/ef e5d< eeddd3ddd5Zqed/ef e5d< dede+d#e+de
ddf
ddZreeddderd ddZsed/ef e5d< eeddd3ddd5Zted/ef e5d< ee3ddZdZddd	Zued/ef e5d
< deddfddZvee3dddddddZwed/ef e5d< eeddd3ddd5Zxed/ef e5d< eeddddg g dddZyed/ef e5d< eeddddg g d d!dZzed/ef e5d"< d#e4e6e7e8e9e;e<eAeBeCeDeEeFeNeGeHeceeeqe:exeyezgd$Z{ee+ef e5d%< d&eJeKeLeMgd$Z|ee+ef e5d'< dS (*  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_HELPOptionOptionGroupOptionParserValues)dedent)AnyCallableDictOptionalTuplecanonicalize_name)ConfigOptionParser)	BAR_TYPES)CommandError)USER_CACHE_DIRget_src_prefix)FormatControl)PyPI)TargetPython)STRONG_HASHES)	strtoboolparseroptionmsgreturnc                 C   s0   | d| }t d| }| | dS )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)textwrapfilljoinspliterror)r   r   r    r$   X/var/www/html/olx_land/venv/lib/python3.10/site-packages/pip/_internal/cli/cmdoptions.pyraise_option_error$   s   	r&   groupc                 C   s,   t || d }| d D ]}||  q|S )z
    Return an OptionGroup object
    group  -- assumed to be dict with 'name' and 'options' keys
    parser -- an optparse Parser
    nameoptions)r   
add_option)r'   r   option_groupr   r$   r$   r%   make_option_group2   s   r,   r)   check_optionsc                    s\    du r|  dt dtt f fdd}g d}tt||r,| j}|  td dS dS )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nr   c                    s   t  | d S N)getattr)r.   r-   r$   r%   getnameJ      z+check_install_build_global.<locals>.getname)build_optionsglobal_optionsinstall_optionszbDisabling all use of wheels due to the use of --build-option / --global-option / --install-option.)	strr   r	   anymapformat_controldisallow_binariesloggerwarning)r)   r-   r2   namescontrolr$   r1   r%   check_install_build_global>   s   	r@   Fcheck_targetc                 C   sj   t | j| j| j| jg}tt dh}| j|ko| j }|r$|r$t	d|r/|r1| j
s3t	ddS dS dS )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)r8   python_version	platformsabisimplementationr   setr:   ignore_dependenciesr   
target_dir)r)   rA   dist_restriction_setbinary_onlysdist_dependencies_allowedr$   r$   r%   check_dist_restrictionW   s*   	
rL   optvaluec                 C   s   t j|S r/   )ospath
expanduserr   rM   rN   r$   r$   r%   _path_option_check   r3   rS   c                 C   s   t |S r/   r   rR   r$   r$   r%   _package_name_option_check   s   rT   c                   @   s0   e Zd Zejd Zej Zeed< eed< dS )	PipOption)rP   package_namerV   rP   N)	__name__
__module____qualname__r   TYPESTYPE_CHECKERcopyrT   rS   r$   r$   r$   r%   rU      s
    

rU   z-hz--helphelpz
Show help.)destactionr]   .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_venvzMAllow pip to only run in a virtual environment; exit with an error otherwise.require_virtualenvz-vz	--verboseverbosecountzDGive more output. Option is additive, and can be used up to 3 times.z
--no-colorno_colorzSuppress colored output.z-Vz	--versionversionzShow version and exit.z-qz--quietquietzGive 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_barchoiceonz*Specify type of progress to be displayed [|z] (default: %default))r^   typechoicesrd   r]   z--logz
--log-filez--local-loglogrP   z Path to a verbose appending log.)r^   metavarrq   r]   z
--no-inputno_inputzDisable prompting for input.z--proxyproxyr7    z<Specify a proxy in the form [user:passwd@]proxy.server:port.)r^   rq   rd   r]   z	--retriesretriesint   zRMaximum number of retries each connection should attempt (default %default times).z	--timeoutz--default-timeoutsectimeoutfloat   z2Set the socket timeout (default %default seconds).)rt   r^   rq   rd   r]   c                
   C   s   t dddg dg ddddS )	Nz--exists-actionexists_actionrn   )siwbaappendr_   zYDefault action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup, (a)bort.)r^   rq   rr   rd   r_   rt   r]   r   r$   r$   r$   r%   r   ,  s   r   z--certcertzPath to PEM-encoded CA certificate bundle. If provided, overrides the default. See 'SSL Certificate Verification' in pip documentation for more information.)r^   rq   rt   r]   z--client-certclient_certzkPath to SSL client certificate, a single file containing the private key and the certificate in PEM format.)r^   rq   rd   rt   r]   z-iz--index-urlz
--pypi-url	index_urlURLzBase 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.)r^   rt   rd   r]   c                   C      t ddddg ddS )Nz--extra-index-urlextra_index_urlsr   r   zmExtra URLs of package indexes to use in addition to --index-url. Should follow the same rules as --index-url.r^   rt   r_   rd   r]   r   r$   r$   r$   r%   extra_index_urlc     r   z
--no-indexno_indexzAIgnore package index (only looking at --find-links URLs instead).c                	   C      t ddddg dddS )Nz-fz--find-links
find_linksr   urla  If 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.r^   r_   rd   rt   r]   r   r$   r$   r$   r%   r   z     r   c                   C   r   )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.)r^   r_   rt   rd   r]   r   r$   r$   r$   r%   trusted_host  r   r   c                	   C   r   )Nz-cz--constraintconstraintsr   filez\Constrain versions using the given constraints file. This option can be used multiple times.r   r   r$   r$   r$   r%   r     r   r   c                	   C   r   )Nz-rz--requirementrequirementsr   r   zQInstall from the given requirements file. This option can be used multiple times.r   r   r$   r$   r$   r%   r     r   r   c                	   C   r   )Nz-ez
--editable	editablesr   zpath/urlzkInstall a project in editable mode (i.e. setuptools "develop mode") from a local project path or a VCS url.r   r   r$   r$   r$   r%   editable  s   r   opt_strc                 C   s    t j|}t|j| j| d S r/   )rO   rP   abspathsetattrvaluesr^   )r   r   rN   r   r$   r$   r%   _handle_src  s   r   z--srcz--sourcez--source-dirz--source-directorysrc_dirdircallbackzDirectory to check out editable projects into. The default in a virtualenv is "<venv path>/src". The default for global installs is "<current dir>/src".)r^   rq   rt   rd   r_   r   r]   srcr   c                 C   s   t | |jS )zGet a format_control object.)r0   r^   )r   r   r$   r$   r%   _get_format_control  s   r   c                 C   "   t |j| }t||j|j d S r/   )r   r   r   handle_mutual_excludes	no_binaryonly_binaryr   r   rN   r   existingr$   r$   r%   _handle_no_binary     r   c                 C   r   r/   )r   r   r   r   r   r   r   r$   r$   r%   _handle_only_binary  r   r   c               	   C   $   t t t } tdddtd| ddS )Nz--no-binaryr:   r   r7   av  Do 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_   r   rq   rd   r]   )r   rF   r   r   r:   r$   r$   r%   r        r   c               	   C   r   )Nz--only-binaryr:   r   r7   aK  Do 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   )r   rF   r   r   r   r$   r$   r%   r     r   r   z
--platformrC   platformr   zOnly use wheels compatible with <platform>. Defaults to the platform of the running system. Use this option multiple times to specify multiple platforms supported by the target interpreter.r   c                 C   s   | sdS |  d}t|dkrdS t|dkr+|d } t| dkr+| d | dd g}ztdd	 |D }W |dfS  tyC   Y d
S w )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 allowed   r   Nc                 s   s    | ]}t |V  qd S r/   )ry   ).0partr$   r$   r%   	<genexpr>;  s    z*_convert_python_version.<locals>.<genexpr>)r$   z$each version part must be an integer)r"   lentuple
ValueError)rN   partsversion_infor$   r$   r%   _convert_python_version%  s   
r   c                 C   s:   t |\}}|durd||}t|| |d ||j_dS )z3
    Handle a provided --python-version value.
    Nz(invalid --python-version value: {!r}: {}r   r   )r   formatr&   r   rB   )r   r   rN   r   r   	error_msgr   r$   r$   r%   _handle_python_versionB  s   r   z--python-versionrB   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).
    )r^   rt   r_   r   rq   rd   r]   z--implementationrE   zOnly use wheels compatible with Python implementation <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--abirD   abiaL  Only use wheels compatible with Python abi <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_optsc                 C   s4   |  t  |  t  |  t  |  t  d S r/   )r*   rC   rB   rE   rD   )r   r$   r$   r%   add_target_python_options  s   r   c                 C   s   t | j| j| j| jd}|S )N)rC   py_version_inforD   rE   )r   rC   rB   rD   rE   )r)   target_pythonr$   r$   r%   make_target_python  s   r   c                   C   s   t ddddddS )Nz--prefer-binaryprefer_binaryrb   Fz8Prefer older binary packages over newer source packages.rc   r   r$   r$   r$   r%   r     s   r   z--cache-dir	cache_dirzStore the cache data in <dir>.)r^   rd   rt   rq   r]   c              
   C   sX   |dur&zt | W n ty% } zt|| t|d W Y d}~nd}~ww d|j_dS )z
    Process a value provided for the --no-cache-dir option.

    This is an optparse.Option callback for the --no-cache-dir option.
    Nr   F)r   r   r&   r7   r   r   )r   rM   rN   r   excr$   r$   r%   _handle_no_cache_dir  s   
r   z--no-cache-dirzDisable the cache.)r^   r_   r   r]   no_cachez	--no-depsz--no-dependenciesrG   z#Don't install package dependencies.no_depsz--ignore-requires-pythonignore_requires_pythonz'Ignore the Requires-Python information.z--no-build-isolationbuild_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_isolationc                 C   s&   |durd}t || |d d|j_dS )z
    Process a value provided for the --no-use-pep517 option.

    This is an optparse.Option callback for the no_use_pep517 option.
    Na0  A 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   F)r&   r   
use_pep517)r   rM   rN   r   r   r$   r$   r%   _handle_no_use_pep517  s   r   z--use-pep517r   z^Use PEP 517 for building source distributions (use --no-use-pep517 to force legacy behaviour).z--no-use-pep517)r^   r_   r   rd   r]   no_use_pep517z--install-optionr6   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_   rt   r]   z--build-optionr4   z9Extra arguments to be supplied to 'setup.py bdist_wheel'.)r^   rt   r_   r]   z--global-optionr5   zcExtra 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_   rd   r]   no_cleanz--prezYInclude pre-release and development versions. By default, pip only finds stable versions.prez--disable-pip-version-checkdisable_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                 C   s   |j jsi |j _z
|dd\}}W n ty#   |d| Y nw |tvr4|d|dt |j j|g 	| dS )zkGiven a value spelled "algo:digest", append the digest to a list
    pointed to in a dict by the algo name.:r   zTArguments to {} must be a hash name followed by a value, like --hash=sha256:abcde...z&Allowed hash algorithms for {} are {}.z, N)
r   hashesr"   r   r#   r   r   r!   
setdefaultr   )r   r   rN   r   algodigestr$   r$   r%   _handle_merge_hash^  s"   
r   z--hashr   stringzgVerify that the package's archive matches this hash before installing. Example: --hash=sha256:abcdef...)r^   r_   r   rq   r]   hashz--require-hashesrequire_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^   rq   r_   r]   	list_pathc                 C   s"   | j r| js	| jrtdd S d S )Nz2Cannot combine '--path' with '--user' or '--local')rP   userlocalr   )r)   r$   r$   r%   check_list_path_option  s   r   z	--excludeexcludespackagerV   z)Exclude specified package from the output)r^   r_   rt   rq   r]   list_excludez--no-python-version-warningno_python_version_warningz>Silence deprecation warnings for upcoming unsupported Pythons.z--use-featurefeatures_enabledfeature)z2020-resolverz	fast-depszin-tree-buildz<Enable new functionality, that may be backward incompatible.)r^   rt   r_   rd   rr   r]   use_new_featurez--use-deprecateddeprecated_features_enabled)zlegacy-resolverzout-of-tree-buildzbacktrack-on-build-failureshtml5libzDEnable deprecated functionality, that will be removed in the future.use_deprecated_featurezGeneral Options)r(   r)   general_groupzPackage Index Optionsindex_groupr/   )F)}__doc__loggingrO   r   	functoolsr   optparser   r   r   r   r   r   typingr	   r
   r   r   r   pip._vendor.packaging.utilsr   pip._internal.cli.parserr   pip._internal.cli.progress_barsr   pip._internal.exceptionsr   pip._internal.locationsr   r   #pip._internal.models.format_controlr   pip._internal.models.indexr   "pip._internal.models.target_pythonr   pip._internal.utils.hashesr   pip._internal.utils.miscr   	getLoggerrW   r<   r7   r&   r,   r@   boolrL   rS   rT   rU   r`   __annotations__ra   re   rg   rh   rj   rk   rl   listkeysr!   rm   rs   ru   rv   rx   r|   r   r   r   
simple_urlr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rC   ry   r   r   rB   rE   rD   r   r   r   r   r   r   r   r   r   r   r   r   r6   r4   r5   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r$   r$   r$   r%   <module>   s   

(	
		

	



&


	



	
	

