
    ifG                     0   d Z ddlZddlZddlZddl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" ddl#m$Z$ ddl%m&Z& ddl'm(Z(m)Z)m*Z*m+Z+ ddl,m-Z- ddl.m/Z/ ddl0m1Z1 ddl2m3Z3 ddl4m5Z5m6Z6m7Z7 ddl8m9Z9 e	rddl:m;Z;  ej<        e=          Z>ded         fdZ? G d de          Z@ G d d ee@          ZAe7jB        e7jC        e7jD        gZEd&d!ZFd"e
de
fd#ZG G d$ d%eA          ZHdS )'a  Contains the Command base classes that depend on PipSession.

The classes in this module are in a separate module so the commands not
needing download / PackageFinder capability don't unnecessarily import the
PackageFinder machinery and all its vendored dependencies, etc.
    N)partial)Values)TYPE_CHECKINGAnyListOptionalTuple)
WheelCache)
cmdoptions)Command)CommandContextMixIn)CommandErrorPreviousBuildDirError)LinkCollector)PackageFinder)SelectionPreferences)TargetPython)
PipSession)BuildTracker)RequirementPreparer)install_req_from_editableinstall_req_from_line#install_req_from_parsed_requirementinstall_req_from_req_string)parse_requirements)InstallRequirement)BaseResolver)pip_self_version_check)TempDirectoryTempDirectoryTypeRegistrytempdir_kinds)running_under_virtualenv)
SSLContextreturnr#   c                  .   t           j        dk     rt          d          	 dd l} n+# t          $ r t
                              d           Y d S w xY w	 ddlm} n$# t          $ r}t          d|           d }~ww xY w|	                    | j
                  S )N)   
   z9The truststore feature is only available for Python 3.10+r   z1Disabling truststore since ssl support is missing)
truststorez'The truststore feature is unavailable: )sysversion_infor   sslImportErrorloggerwarningpip._vendorr(   r#   PROTOCOL_TLS_CLIENT)r+   r(   es      O/var/www/html/env/lib/python3.11/site-packages/pip/_internal/cli/req_command.py_create_truststore_ssl_contextr3   2   s    
'!!VWWW



   JKKKttJ******* J J JHQHHIIIJ   !8999s'   & $AAA 
A:#A55A:c                        e Zd ZdZd fdZededeee	                  fd            Z
dedefdZ	 	 	 dded	ee         d
ee         dedef
dZ xZS )SessionCommandMixinzE
    A class mixin for command classes needing _build_session().
    r$   Nc                 V    t                                                       d | _        d S N)super__init___session)self	__class__s    r2   r9   zSessionCommandMixin.__init__J   s$    .2    optionsc                     g }t          |dd          s(t          |dd          }|r|                    |           t          |dd          }|r|                    |           |pdS )z7Return a list of index urls from user-provided options.no_indexF	index_urlNextra_index_urls)getattrappendextend)clsr>   
index_urlsurlurlss        r2   _get_index_urlsz#SessionCommandMixin._get_index_urlsN   s     
w
E22 	'';55C '!!#&&&w 2D99 	$d###!T!r=   c                     | j         6|                     |                     |                    | _         | j         J | j         S )zGet a default-managed session.)r:   enter_context_build_session)r;   r>   s     r2   get_default_sessionz'SessionCommandMixin.get_default_session\   sE    =  ..t/B/B7/K/KLLDM =,,,}r=   Fretriestimeoutfallback_to_certific                 b   |j         }|r!t          j                            |          sJ d|j        v r%	 t                      }n# t          $ r |s d }Y nw xY wd }t          |r t          j                            |d          nd ||n|j	        |j
        |                     |          |          }|j        r|j        |_        |j        r|j        |_        |j        s|r||n|j        |_        |j        r|j        |j        d|_        |j         |j        _        |j        |j        _        |S )Nr(   zhttp-v2)cacherO   trusted_hostsrG   ssl_context)httphttps)	cache_dirospathisabsfeatures_enabledr3   	Exceptionr   joinrO   rT   rJ   certverifyclient_certrP   proxyproxiesno_inputauth	promptingkeyring_provider)r;   r>   rO   rP   rQ   rX   rU   sessions           r2   rM   z"SessionCommandMixin._build_sessionf   su    %	8i 8 88887333#<>> # # #* "#
 K8AK"',,y)444t&2GG!/++G44#
 
 
 < 	*$\GN  	/".GL ? 	Rg 	R)0)<gg'/GO = 	  GO &-%5!5(/(@%s   A AAr$   N)NNF)__name__
__module____qualname____doc__r9   classmethodr   r   r   strrJ   r   rN   intboolrM   __classcell__r<   s   @r2   r5   r5   D   s         3 3 3 3 3 3 "f "$s)1D " " " ["6 j     "&!%$)3 33 #3 #	3
 "3 
3 3 3 3 3 3 3 3r=   r5   c                   "    e Zd ZdZdeddfdZdS )IndexGroupCommandz
    Abstract base class for commands with the index_group options.

    This also corresponds to the commands that permit the pip version check.
    r>   r$   Nc                     t          |d          sJ |j        s|j        rdS |                     |dt	          d|j                  d          }|5  t          ||           ddd           dS # 1 swxY w Y   dS )z
        Do the pip version check if not disabled.

        This overrides the default behavior of not doing the check.
        r@   Nr      T)rO   rP   rQ   )hasattrdisable_pip_version_checkr@   rM   minrP   r   )r;   r>   rh   s      r2   handle_pip_version_checkz*IndexGroupCommand.handle_pip_version_check   s     w
+++++, 	0@ 	F %%7?++
 !% & 	
 	
  	5 	5"7G444	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5 	5s   A//A36A3)rj   rk   rl   rm   r   r{    r=   r2   ru   ru      s@         5 54 5 5 5 5 5 5r=   ru   c                      t                      rdS t          t          d          sdS t          j        dk    st          j        dk    rdS t          j                    dk    rdS t                              d           dS )zOutput a warning for sudo users on Unix.

    In a virtual environment, sudo pip still writes to virtualenv.
    On Windows, users may run pip as Administrator without issues.
    This warning only applies to Unix root users outside of virtualenv.
    Ngetuidwin32cygwinr   zRunning pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv)r"   rx   rY   r)   platformr~   r-   r.   r|   r=   r2   warn_if_run_as_rootr      s      !! 2x    |w#,(":":	y{{a
NN	,    r=   funcc           	           dt           ddfddt          dt          dt          t                   dt
          t                   f fd}|S )	zNDecorator for common logic related to managing temporary
    directories.
    registryr$   Nc                 F    t           D ]}|                     |d           d S )NF)KEEPABLE_TEMPDIR_TYPES
set_delete)r   ts     r2   configure_tempdir_registryz0with_cleanup.<locals>.configure_tempdir_registry   s4    ' 	* 	*A5))))	* 	*r=   r;   r>   argsc                     | j         J |j        r | j                    	  | ||          S # t          $ r  | j                     w xY wr7   )tempdir_registryno_cleanr   )r;   r>   r   r   r   s      r2   wrapperzwith_cleanup.<locals>.wrapper   s     $000 	>&&t'<===	4gt,,,$ 	 	 	 '&t'<===	s	   0 A)r    RequirementCommandr   r   r   r   rp   )r   r   r   s   ` @r2   with_cleanupr      sy    
*-F *4 * * * * +19=c	#        Nr=   c                       e Zd Zdededdf fdZededefd            Ze		 	 d"d	e
ded
ededededee         dedefd            Ze		 	 	 	 	 	 	 	 d#dedededee         dedededededee         deeedf                  defd            Zdee         dedededee         f
dZededdfd            Z	 	 d$deded ee         dee         def
d!Z xZS )%r   r   kwr$   Nc                      t                      j        |i | | j                            t	          j                               d S r7   )r8   r9   cmd_opts
add_optionr   r   )r;   r   r   r<   s      r2   r9   zRequirementCommand.__init__  sD    $%"%%%  !4!6!677777r=   r>   c                     d| j         v rdS dS )zEDetermines which resolver should be used, based on the given options.zlegacy-resolverlegacy
resolvelib)deprecated_features_enabledr>   s    r2   determine_resolver_variantz-RequirementCommand.determine_resolver_variant  s      CCC8|r=   r   temp_build_dirbuild_trackerrh   finderuse_user_sitedownload_dir	verbosityc	                 X   |j         }	|	J d}
|                     |          }|dk    r&d|j        v }|rt                              d           n'd}
d}d|j        v rt                              d           t          |	|j        ||j        |j        |||j	        ||j
        ||||
          S )	zQ
        Create a RequirementPreparer instance for the given parameters.
        NFr   z	fast-depszpip is using lazily downloaded wheels using HTTP range requests to obtain dependency information. This experimental feature is enabled through --use-feature=fast-deps and it is not ready for production.Tz;fast-deps has no effect when used with the legacy resolver.)	build_dirsrc_dirr   build_isolationcheck_build_depsr   rh   progress_barr   require_hashesr   
lazy_wheelr   legacy_resolver)rZ   r   r\   r-   r.   r   r   r   r   r   r   )rF   r   r>   r   rh   r   r   r   r   temp_build_dir_pathr   resolver_variantr   s                r2   make_requirement_preparerz,RequirementCommand.make_requirement_preparer  s     -1"...99'BB|++$(@@J "   #OJg666Q   #)O%#3$5' -"1'!+
 
 
 	
r=   FTto-satisfy-onlypreparerwheel_cacheignore_installedignore_requires_pythonforce_reinstallupgrade_strategy
use_pep517py_version_info.c                 d   t          t          |j        |
          }|                     |          }|dk    r=ddl}|j        j        j        j        	                    ||||||j
        ||||	|          S ddl}|j        j        j        j        	                    ||||||j
        ||||	|          S )zF
        Create a Resolver instance for the given parameters.
        )isolatedr   r   r   N)r   r   r   make_install_reqr   ignore_dependenciesr   r   r   r   r   )r   r   isolated_moder   ,pip._internal.resolution.resolvelib.resolver	_internal
resolutionr   resolverResolverr   (pip._internal.resolution.legacy.resolverr   )rF   r   r   r>   r   r   r   r   r   r   r   r   r   r   pips                  r2   make_resolverz RequirementCommand.make_resolverE  s    $ #'*!
 
 

 99'BB |++????=+6?HH!'!1+$+$?!1'= /!1 / I    	8777}'.7@@#-' ' ;-#9+-+ A 
 
 	
r=   c                    g }|j         D ]E}t          |d|||          D ].}t          ||j        d          }|                    |           /F|D ]E}	t          |	d|j        |j        dt          |dd                    }|                    |           F|j        D ]D}	t          |	d|j        |j        t          |dd                    }|                    |           E|j
        D ]l}t          ||||	          D ]V}t          ||j        |j        d|j        r|j                            d          nd
          }|                    |           Wmt          d |D                       rd|_        |sy|j        sr|j
        skd| j        i}
|j        rAt#           dj        di t'          |
d                    |j                                      t#           dj        di |
          |S )zS
        Parse command-line arguments into the corresponding requirements.
        T)
constraintr   r>   rh   F)r   user_suppliedNconfig_settings)
comes_fromr   r   r   r   )r   r   r   r   )r   r>   rh   )r   r   r   r   c              3   $   K   | ]}|j         V  d S r7   )has_hash_options).0reqs     r2   	<genexpr>z6RequirementCommand.get_requirements.<locals>.<genexpr>  s%      <<s#<<<<<<r=   namezXYou must give at least one requirement to {name} (maybe you meant "pip {name} {links}"?) )linkszHYou must give at least one requirement to {name} (see "pip help {name}")r|   )constraintsr   r   r   rD   r   r   rC   	editablesr   requirementsr>   getanyr   r   
find_linksr   formatdictr^   )r;   r   r>   r   rh   r   filename
parsed_req
req_to_addr   optss              r2   get_requirementsz#RequirementCommand.get_requirements  s    24+ 	0 	0H0   0 0
 A$2"'  

 ##J////0  		, 		,C. ."-" '1BD I I  J 
++++$ 	, 	,C2" ."- '1BD I I  J 
++++  , 	0 	0H0'   0 0
 A$2&1"&!)%J$6$:$:;L$M$M$M  
 ##J////0 <<|<<<<< 	*%)G" 	) 	W-A 	DI&D! "E >>D t388G4F+G+GHHH    #5 ..4= =7;= =  
 r=   c                 x    | j         }|                                }|rt                              |           dS dS )zE
        Trace basic information about the provided objects.
        N)search_scopeget_formatted_locationsr-   info)r   r   	locationss      r2   trace_basic_infoz#RequirementCommand.trace_basic_info  sG     * 88::	 	#KK	"""""	# 	#r=   target_pythonc                     t          j        ||          }t          d|j        |j        |j        |          }t          j        |||          S )z
        Create a package finder appropriate to this requirement command.

        :param ignore_requires_python: Whether to ignore incompatible
            "Requires-Python" values in links. Defaults to False.
        r   T)allow_yankedformat_controlallow_all_prereleasesprefer_binaryr   )link_collectorselection_prefsr   )r   creater   r   prer   r   )r;   r>   rh   r   r   r   r   s          r2   _build_package_finderz(RequirementCommand._build_package_finder  si     '-gwGGG."1")+!/#9
 
 
 #)+'
 
 
 	
r=   )Nr   )NFTFFr   NN)NN)rj   rk   rl   r   r9   staticmethodr   ro   r   rn   r   r   r   r   rq   r   rp   r   r   r
   r	   r   r   r   r   r   r   r   r   rr   rs   s   @r2   r   r      s       8c 8 8 8 8 8 8 8 8
 F s    \  '+4
 4
%4
 4
 $	4

 4
 4
 4
 sm4
 4
 
4
 4
 4
 [4
l  -1#!%', % 1%)598
 8
%8
 8
 	8

 j)8
 8
 8
 !%8
 8
 8
 TN8
 "%S/28
 
8
 8
 8
 [8
tR3iR R 	R
 R 
 	!R R R Rh # #4 # # # \# 1515
 

 
  -	

 !)
 

 
 
 
 
 
 
 
r=   r   ri   )Irm   loggingrY   r)   	functoolsr   optparser   typingr   r   r   r   r	   pip._internal.cacher
   pip._internal.clir   pip._internal.cli.base_commandr   !pip._internal.cli.command_contextr   pip._internal.exceptionsr   r   pip._internal.index.collectorr   "pip._internal.index.package_finderr   $pip._internal.models.selection_prefsr   "pip._internal.models.target_pythonr   pip._internal.network.sessionr   ,pip._internal.operations.build.build_trackerr    pip._internal.operations.preparer   pip._internal.req.constructorsr   r   r   r   pip._internal.req.req_filer   pip._internal.req.req_installr   pip._internal.resolution.baser   !pip._internal.self_outdated_checkr   pip._internal.utils.temp_dirr   r    r!   pip._internal.utils.virtualenvr"   r+   r#   	getLoggerrj   r-   r3   r5   ru   	BUILD_ENVEPHEM_WHEEL_CACHE	REQ_BUILDr   r   r   r   r|   r=   r2   <module>r     sd     				 



             < < < < < < < < < < < < < < * * * * * * ( ( ( ( ( ( 2 2 2 2 2 2 A A A A A A H H H H H H H H 7 7 7 7 7 7 < < < < < < E E E E E E ; ; ; ; ; ; 4 4 4 4 4 4 E E E E E E @ @ @ @ @ @            : 9 9 9 9 9 < < < < < < 6 6 6 6 6 6 D D D D D D         
 D C C C C C 		8	$	$:(> : : : :$U U U U U- U U Up 5  5  5  5  5!4  5  5  5H #    <s s    8y
 y
 y
 y
 y
* y
 y
 y
 y
 y
r=   