
    xi5                       d Z ddlm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 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 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  ejp                  e9      Z:d dZ;e7jx                  e7jz                  e7j|                  gZ? edd      Z@	 	 	 	 d!dZA G d de      ZBy)"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.
    )annotationsN)partial)Values)AnyCallableTypeVar)#SubprocessBuildEnvironmentInstaller)
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_dependency_groups)parse_requirements)InstallRequirement)BaseResolver)TempDirectoryTempDirectoryTypeRegistrytempdir_kindsc                F    t         j                  j                  d      dk(  S )z
    Check if regular constraints should be ignored because
    we are in a isolated build process and build constraints
    feature is enabled but no build constraints were passed.
     _PIP_IN_BUILD_IGNORE_CONSTRAINTS1)osenvirongetoptionss    X/var/www/html/binance/venv/lib/python3.12/site-packages/pip/_internal/cli/req_command.py!should_ignore_regular_constraintsr+   0   s     ::>><=DD    	_CommandTRequirementCommand)boundc                      ddd fd}|S )zNDecorator for common logic related to managing temporary
    directories.
    c                >    t         D ]  }| j                  |d        y )NF)KEEPABLE_TEMPDIR_TYPES
set_delete)registryts     r*   configure_tempdir_registryz0with_cleanup.<locals>.configure_tempdir_registryK   s!    ' 	*A5)	*r,   c                    | j                   J |j                  r | j                          	  | ||      S # t        $ r  | j                           w xY wN)tempdir_registryno_cleanr   )selfr)   argsr6   funcs      r*   wrapperzwith_cleanup.<locals>.wrapperO   sb    $$000&t'<'<=	gt,,$ 	 't'<'<=	s	   	9 A)r4   r    returnNone)r;   r-   r)   r   r<   	list[str]r?   int )r=   r>   r6   s   ` @r*   with_cleanuprD   D   s    * Nr,   c                      e Zd Zd fdZed	d       Ze	 	 d
	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd       Ze	 	 	 	 	 	 	 d	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 dd       Z	 	 	 	 	 	 	 	 	 	 ddZ	edd       Z
	 	 d	 	 	 	 	 	 	 	 	 ddZ xZS )r.   c                    t        |   |i | | j                  j                  t	        j
                                | j                  j                  t	        j                                y r8   )super__init__cmd_opts
add_optionr   dependency_groupsr:   )r;   r<   kw	__class__s      r*   rH   zRequirementCommand.__init__a   sK    $%"%  !=!=!?@  !4!4!67r,   c                "    d| j                   v ryy)zEDetermines which resolver should be used, based on the given options.zlegacy-resolverlegacy
resolvelib)deprecated_features_enabledr(   s    r*   determine_resolver_variantz-RequirementCommand.determine_resolver_variantg   s      C CCr,   c	           
     $   |j                   }	|	J d}
| j                  |      }|dk(  r&d|j                  v }|r=t        j	                  d       n'd}
d}d|j                  v rt        j	                  d       t        |dg       }d|j                  v }t        di d	|	d
|j                  d|d|j                  dt        |||      d|j                  d|d|d|j                  d|d|j                  d|d|d|d|
d|j                  S )zQ
        Create a RequirementPreparer instance for the given parameters.
        FrP   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_constraintszbuild-constraint	build_dirsrc_dirdownload_dirbuild_isolationbuild_isolation_installer)rT    build_constraint_feature_enabledcheck_build_depsbuild_trackersessionprogress_barfinderrequire_hashesuse_user_site
lazy_wheel	verbositylegacy_resolverresume_retriesrC   )pathrR   features_enabledloggerwarninggetattrr   rV   rX   r	   r[   r^   r`   re   )clstemp_build_dirr)   r\   r]   r_   ra   rW   rc   temp_build_dir_pathrd   resolver_variantrb   rT   rZ   s                  r*   make_requirement_preparerz,RequirementCommand.make_requirement_preparero   s    -11"...99'B|+$(@(@@J" #OJg666Q
 $G-@"E'":":: 	) # 
)
OO
 &
 $33	

 'J"31Q'
 %55
 (
 
 !--
 
 #11
  (!
" "#
$  %
& ,'
( #11)
 	
r,   c                   t        t        |j                        }| j                  |      }|dk(  rRddl}|j
                  j                  j                  j                  j                  ||||||j                  ||||	|
      S ddl}|j
                  j                  j                  j                  j                  ||||||j                  ||||	|
      S )zF
        Create a Resolver instance for the given parameters.
        )isolatedrP   r   N)preparerr_   wheel_cachemake_install_reqra   ignore_dependenciesignore_installedignore_requires_pythonforce_reinstallupgrade_strategypy_version_info)r   r   isolated_moderR   ,pip._internal.resolution.resolvelib.resolver	_internal
resolutionrP   resolverResolverru   (pip._internal.resolution.legacy.resolverrO   )rk   rr   r_   r)   rs   ra   rv   rw   rx   ry   rz   rt   rn   pips                 r*   make_resolverz RequirementCommand.make_resolver   s    " #'**
 99'B |+?==++66??HH!'!1+$+$?$?!1'= /!1 / I   	8}}''..77@@#-' ' ; ;-#9+-+ A 
 	
r,   c                   g }t        |      sO|j                  D ]@  }t        |d|||      D ]+  }t        ||j                  d      }|j                  |       - B |D ]8  }	t        |	d|j                  dt        |dd            }|j                  |       : |j                  rCt        |j                        D ]+  }	t        |	|j                  d      }|j                  |       - |j                  D ]7  }	t        |	d|j                  t        |dd            }|j                  |       9 |j                  D ]g  }t        ||||	      D ]S  }t        ||j                  d|j                  r|j                  j                  d      nd
      }|j                  |       U i t!        d |D              rd|_        |s|j                  s|j                  s|j                  std| j$                  i}
|j&                  r?t)         dj*                  di t-        |
dj/                  |j&                                    t)         dj*                  di |
      |S )zS
        Parse command-line arguments into the corresponding requirements.
        T)
constraintr_   r)   r]   F)rq   user_suppliedNconfig_settings)
comes_fromrq   r   r   )r   rq   r   )r_   r)   r]   )rq   r   r   c              3  4   K   | ]  }|j                     y wr8   )has_hash_options).0reqs     r*   	<genexpr>z6RequirementCommand.get_requirements.<locals>.<genexpr>5  s     <s##<s   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}")rC   )r+   constraintsr   r   r{   appendr   rj   rK   r   r   	editablesr   requirementsr)   r'   anyr`   r   
find_linksr   formatdictjoin)r;   r<   r)   r_   r]   r   filename
parsed_req
req_to_addr   optss              r*   get_requirementsz#RequirementCommand.get_requirements   s    2409#// 4"4#!### 4J "E"!(!6!6&+"J
 !''
344  	,C. .." '1BD IJ 
+	, $$.w/H/HI 08$22"&

 ##J/0 $$ 	,C2" .. '1BD I	J 
+	,  ,, 	0H0' 0
 A$22"& &-- #**../@A!	
 ##J/0	0" <|<<%)G"   ##((DII&D!!"E >>Dft388G4F4F+GH  #5 ..4f=7;= 
 r,   c                l    | j                   }|j                         }|rt        j                  |       yy)zE
        Trace basic information about the provided objects.
        N)search_scopeget_formatted_locationsrh   info)r_   r   	locationss      r*   trace_basic_infoz#RequirementCommand.trace_basic_infoN  s1     ** 88:	KK	" r,   c                    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_binaryrw   )link_collectorselection_prefstarget_python)r   creater   r   prer   r   )r;   r)   r]   r   rw   r   r   s          r*   _build_package_finderz(RequirementCommand._build_package_finderY  s]     '--gwG."11")++!//#9
 ##)+'
 	
r,   )r<   r   rL   r   r?   r@   )r)   r   r?   str)Nr   )rl   r   r)   r   r\   r   r]   r   r_   r   ra   boolrW   z
str | Nonerc   rB   r?   r   )NFTFFzto-satisfy-onlyN)rr   r   r_   r   r)   r   rs   zWheelCache | Nonera   r   rv   r   rw   r   rx   r   ry   r   rz   ztuple[int, ...] | Noner?   r   )
r<   rA   r)   r   r_   r   r]   r   r?   zlist[InstallRequirement])r_   r   r?   r@   )NN)
r)   r   r]   r   r   zTargetPython | Nonerw   zbool | Noner?   r   )__name__
__module____qualname__rH   staticmethodrR   classmethodro   r   r   r   r   __classcell__)rM   s   @r*   r.   r.   `   s   8    $(@
%@
 @
 $	@

 @
 @
 @
 !@
 @
 
@
 @
D  *.#!%', % 1266
%6
 6
 	6

 '6
 6
 6
 !%6
 6
 6
 06
 
6
 6
paa a 	a
 a 
"aF # # .2.2

 
 +	

 !,
 

r,   )r)   r   r?   r   )r=   -Callable[[_CommandT, Values, list[str]], int]r?   r   )C__doc__
__future__r   loggingr%   	functoolsr   optparser   typingr   r   r   pip._internal.build_envr	   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_dependency_groupr   pip._internal.req.req_filer   pip._internal.req.req_installr   pip._internal.resolution.baser   pip._internal.utils.temp_dirr   r    r!   	getLoggerr   rh   r+   	BUILD_ENVEPHEM_WHEEL_CACHE	REQ_BUILDr2   r-   rD   r.   rC   r,   r*   <module>r      s    #  	   ) ) G * ( = V H 7 < E ; 4 E @  K 9 < 6  
		8	$E ##  K';<	
728S
* S
r,   