
    [f/                        d 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
 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l,m-Z- ddl.m/Z/m0Z0m1Z1  ej2        e3          Z4e1j5        e1j6        e1j7        gZ8dedefdZ9 G d de          Z:dS )zContains the RequirementCommand base class.

This class is in a separate module so the commands that do not always
need PackageFinder capability don't unnecessarily import the
PackageFinder machinery and all its vendored dependencies, etc.
    N)partial)Values)AnyListOptionalTuple)
WheelCache)
cmdoptions)IndexGroupCommand)SessionCommandMixin)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)TempDirectoryTempDirectoryTypeRegistrytempdir_kindsfuncreturnc           	           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     =lib/python3.11/site-packages/pip/_internal/cli/req_command.pyconfigure_tempdir_registryz0with_cleanup.<locals>.configure_tempdir_registry7   s4    ' 	* 	*A5))))	* 	*    selfoptionsargsc                     | j         J |j        r | j                    	  | ||          S # t          $ r  | j                     w xY wN)tempdir_registryno_cleanr   )r+   r,   r-   r)   r    s      r(   wrapperzwith_cleanup.<locals>.wrapper;   s     $000 	>&&t'<===	4gt,,,$ 	 	 	 '&t'<===	s	   0 A)r   RequirementCommandr   r   r   r   int)r    r2   r)   s   ` @r(   with_cleanupr5   2   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 )%r3   r-   kwr!   Nc                      t                      j        |i | | j                            t	          j                               d S r/   )super__init__cmd_opts
add_optionr
   r1   )r+   r-   r7   	__class__s      r(   r:   zRequirementCommand.__init__O   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    r(   determine_resolver_variantz-RequirementCommand.determine_resolver_variantT   s      CCC8|r*   r   temp_build_dirbuild_trackersession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_dirrI   build_isolationcheck_build_depsrE   rF   progress_barrG   require_hashesrH   
lazy_wheelrJ   legacy_resolver)pathrC   features_enabledloggerwarningr   rM   rN   rO   rP   rQ   )clsrD   r,   rE   rF   rG   rH   rI   rJ   temp_build_dir_pathrS   resolver_variantrR   s                r(   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.
        )isolatedrc   r@   r   N)r]   rG   r^   make_install_reqrH   ignore_dependenciesr_   r`   ra   rb   rd   )r   r   isolated_moderC   ,pip._internal.resolution.resolvelib.resolver	_internal
resolutionr@   resolverResolverrh   (pip._internal.resolution.legacy.resolverr?   )rX   r]   rG   r,   r^   rH   r_   r`   ra   rb   rc   rd   rg   rZ   pips                  r(   make_resolverz RequirementCommand.make_resolver   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)
constraintrG   r,   rF   F)rf   user_suppliedNconfig_settings)
comes_fromrf   rc   rt   ru   )rt   rf   rc   ru   )rG   r,   rF   )rf   rc   rt   ru   c              3   $   K   | ]}|j         V  d S r/   )has_hash_options).0reqs     r(   	<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}") )constraintsr   r   ri   appendr   rc   getattr	editablesr   requirementsr,   getanyrQ   r|   
find_linksr   formatdictjoin)r+   r-   r,   rG   rF   r   filename
parsed_req
req_to_addrz   optss              r(   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"& &-"
*../@AAA!
 
 

 ##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_locationsrV   info)rG   r   	locationss      r(   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.
        rB   T)allow_yankedformat_controlallow_all_prereleasesprefer_binaryr`   )link_collectorselection_prefsr   )r   creater   r   prer   r   )r+   r,   rF   r   r`   r   r   s          r(   _build_package_finderz(RequirementCommand._build_package_finder/  si     '-gwGGG."1")+!/#9
 
 
 #)+'
 
 
 	
r*   )Nr   )NFTFFr\   NN)NN)__name__
__module____qualname__r   r:   staticmethodr   strrC   classmethodr   r   r   r   boolr   r4   r   r[   r	   r   r   rq   r   r   r   r   r   r   __classcell__)r=   s   @r(   r3   r3   N   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T3iT T 	T
 T 
 	!T T T Tl # #4 # # # \# 1515
 

 
  -	

 !)
 

 
 
 
 
 
 
 
r*   r3   );__doc__logging	functoolsr   optparser   typingr   r   r   r   pip._internal.cacher	   pip._internal.clir
   pip._internal.cli.index_commandr   r   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.utils.temp_dirr   r   r   	getLoggerr   rV   	BUILD_ENVEPHEM_WHEEL_CACHE	REQ_BUILDr%   r5   r3   r   r*   r(   <module>r      sw                 - - - - - - - - - - - - * * * * * * ( ( ( ( ( ( = = = = = = V V V V V V 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          
	8	$	$ # s s    8{
 {
 {
 {
 {
* {
 {
 {
 {
 {
r*   