
    q"hn                        S r SSKrSSKrSSKrSSKJr  SSKJr  SSKJ	r	J
r
JrJr  SSKJr  SSKJr  SSKJr  SS	KJrJrJrJrJrJrJr  SS
KJr  SSKJrJr  SSK J!r!  SSK"J#r#  SSK$J%r%  SSK&J'r'J(r(  SSK)J*r*J+r+  SSK,J-r-  SSK.J/r/  SSK0J1r1  SSK2J3r3  SSK4J5r5J6r6  SSK7J8r8J9r9  SSK:J;r;  SSK<J=r=J>r>J?r?J@r@  SSKAJBrB  SSKCJDrD  SSKEJFrF  \3" \G5      rHS\1S\/S\S\IS \IS!\4S" jrJS#\#S$\KS%\LS!S4S& jrM\ " S' S(5      5       rN  S3S#\#S)\(S*\\K   S+\\8   S!\N4
S, jjrO S3S#\#S*\\K   S+\\8   S!\N4S- jjrP  S3S#\#S$\KS)\(S%\LS*\\K   S+\\8   S!\\N   4S. jjrQ S4S#\#S*\KS+\\8   S/\IS!\\K   4
S0 jjrR " S1 S25      rSg)5z(Prepares a distribution for installation    N)	dataclass)Path)DictIterableListOptional)canonicalize_name))make_distribution_for_install_requirement)InstalledDistribution)DirectoryUrlHashUnsupportedHashMismatchHashUnpinnedInstallationErrorMetadataInconsistentNetworkConnectionErrorVcsHashUnsupported)PackageFinder)BaseDistributionget_metadata_distribution)ArchiveInfo)Link)Wheel)BatchDownloader
Downloader)HTTPRangeRequestUnsupporteddist_from_wheel_url)
PipSession)BuildTracker)InstallRequirement)	getLogger)direct_url_for_editabledirect_url_from_link)HashesMissingHashes)
indent_log)display_path	hash_filehide_urlredact_auth_from_requirement)TempDirectory)unpack_file)vcsreqbuild_trackerfinderbuild_isolationcheck_build_depsreturnc                    [        U 5      nUR                  nUb<  UR                  X5         UR                  X#U5        SSS5        UR	                  5       $ UR	                  5       $ ! , (       d  f       UR	                  5       $ = f)z(Prepare a distribution for installation.N)r
   build_tracker_idtrackprepare_distribution_metadatar   )r-   r.   r/   r0   r1   abstract_dist
tracker_ids          R/var/www/html/env/lib/python3.13/site-packages/pip/_internal/operations/prepare.py_get_prepared_distributionr:   ;   s     >cBM//J  177)9 2 2244=2244	 21 2244s   A''
Blinklocation	verbosityc                     [         R                  " U R                  5      nUc   eUR                  U[	        U R
                  5      US9  g )N)urlr=   )r,   get_backend_for_schemeschemeunpackr(   r?   )r;   r<   r=   vcs_backends       r9   unpack_vcs_linkrD   M   s@    ,,T[[9K"""xXdhh%79M    c                   >    \ rS rSr% \\S'   Sr\\   \S'   SS jrSr	g)FileS   pathNcontent_typec                     U R                   c*   [        R                  " U R                  5      S   U l         g g ! [         a     g f = f)Nr   )rJ   	mimetypes
guess_typerI   OSError)selfs    r9   __post_init__File.__post_init__X   sH    $$-$8$8$CA$F!	 %
  s   (9 
AArJ   )r2   N)
__name__
__module____qualname____firstlineno__str__annotations__rJ   r   rP   __static_attributes__ rE   r9   rG   rG   S   s    
I"&L(3-&rE   rG   downloaddownload_dirhashesc                     [        SSS9nS nU(       a  [        XU5      nU(       a  UnS nO,U" XR                  5      u  pgU(       a  UR                  U5        [	        Xg5      $ )NrB   Tkindglobally_managed)r*   _check_download_dirrI   check_against_pathrG   )r;   r[   r\   r]   temp_diralready_downloaded_path	from_pathrJ   s           r9   get_http_urlrg   b   sb     (TBH""5d&"Q+	 #+4"?	%%i0	((rE   c                     SnU(       a  [        XU5      nU(       a  UnOU R                  nU(       a  UR                  U5        [        US5      $ )z'Get file and optionally check its hash.N)rb   	file_pathrc   rG   )r;   r\   r]   re   rf   s        r9   get_file_urlrj   z   sK    
 #"5d&"Q+	NN	 !!),	4  rE   c                    U R                   (       a  [        XUS9  gU R                  5       (       a   eU R                  (       a  [	        XUS9nO[        U UUUS9nU R                  (       d   [        UR                  XR                  5        U$ )aK  Unpack link into location, downloading if required.

:param hashes: A Hashes object, one of whose embedded hashes must match,
    or HashMismatch will be raised. If the Hashes is empty, no matches are
    required, and unhashable types of requirements (like VCS ones, which
    would ordinarily raise HashUnsupported) are allowed.
)r=   Nr]   )
is_vcsrD   is_existing_diris_filerj   rg   is_wheelr+   rI   rJ   )r;   r<   r[   r=   r\   r]   files          r9   
unpack_urlrr      s|      {{)<##%%%% ||Dv> 	
 ==DIIx):):;KrE   warn_on_hash_mismatchc                    [         R                  R                  XR                  5      n[         R                  R	                  U5      (       d  g[
        R                  SU5        U(       a   UR                  U5        U$ U$ ! [         a6    U(       a  [
        R                  SU5        [         R                  " U5         gf = f)zyCheck download_dir for previously downloaded file with correct hash
If a correct file is found return its path else None
NzFile was already downloaded %sz;Previously-downloaded file %s has bad hash. Re-downloading.)osrI   joinfilenameexistsloggerinforc   r   warningunlink)r;   r\   r]   rs   download_paths        r9   rb   rb      s     GGLL}}=M77>>-(( KK0-@		%%m4 =  	$Q! IIm$	s   -B =CCc                      ^  \ rS rSrSrS\S\\   S\S\S\S\S	\	S
\S\
S\S\S\S\S\S\SS4 U 4S jjrS\SS4S jrS\S\SS4S jrS\S\4S jrS\S\\   4S jrS\S\\   4S jrS\S\\   4S jr S)S\\   S\SS4S jjr S)S\S\S\4S  jjr S)S!\\   S\SS4S" jjrS\S\S\4S# jrS\SS4S$ jrS\S\4S% jrS\S&\S\4S' jrS(rU =r $ )*RequirementPreparer   zPrepares a Requirement	build_dirr\   src_dirr0   r1   r.   sessionprogress_barr/   require_hashesuse_user_site
lazy_wheelr=   legacy_resolverresume_retriesr2   Nc                   > [         TU ]  5         X0l        Xl        X`l        Xpl        [        XxU5      U l        [        XxU5      U l	        Xl
        X l        X@l        XPl        Xl        Xl        Xl        Xl        Xl        0 U l        SU l        g )N) r   )super__init__r   r   r.   _sessionr   	_downloadr   _batch_downloadr/   r\   r0   r1   r   r   use_lazy_wheelr=   r   _downloaded_previous_requirement_header)rO   r   r\   r   r0   r1   r.   r   r   r/   r   r   r   r=   r   r   	__class__s                   r9   r   RequirementPreparer.__init__   s    $ 	"*#G>J.wnU )  / !1 - + ) #  / ,. -5)rE   r-   c                 $   UR                   R                  (       a<  UR                  (       d+  Sn[        [	        UR                   R
                  5      5      nO3SnUR                  (       a  [        UR                  5      O
[        U5      nUR                  (       ag  UR                  (       aV  [        UR                  [        5      (       a  UR                  nOUR                  R                  5       nU(       a	  USU S3-  nX#4U R                  :w  a  X#4U l        [        R                  X#5        UR                  (       a>  [        5          [        R                  SUR                   R                  5        SSS5        gg! , (       d  f       g= f)z3Provide context for the requirement being prepared.zProcessing %szCollecting %sz (from )zUsing cached %sN)r;   ro   is_wheel_from_cacherW   r&   ri   r-   r)   
comes_from
isinstancerf   r   ry   rz   r%   rw   )rO   r-   messageinformationr   s        r9   _log_preparing_link'RequirementPreparer._log_preparing_link  s
   88C$;$;%Gl388+=+=>?K%GCF776sww?PSTWPXK 77s~~#..#..,/NN
 ^^557
A66!T%F%FF180FD-KK-""-sxx/@/@A  #s   +F
Fparallel_buildsc                 &   UR                   R                  (       a  gUR                  b   eUR                   R                  5       (       a  UR                   R                  Ul        gUR                  U R                  SUS9  UR                  5         g)z1Ensure source_dir of a linked InstallRequirement.NT)
autodeleter   )r;   rp   
source_dirrn   ri   ensure_has_source_dirr   ensure_pristine_source_checkout)rO   r-   r   s      r9   _ensure_link_req_src_dir,RequirementPreparer._ensure_link_req_src_dir4  s}    
 88 ~~%%%88##%% XX//CN 	!!NN+ 	" 	

 	++-rE   c                 v   U R                   (       d  UR                  SS9$ UR                  R                  (       a
  [	        5       eUR                  R                  5       (       a
  [        5       eUR                  (       d  UR                  (       d
  [        5       eUR                  SS9=(       d
    [        5       $ )NT)trust_internetF)r   r]   r;   rm   r   rn   r   	is_direct	is_pinnedr   r$   rO   r-   s     r9   _get_linked_req_hashes*RequirementPreparer._get_linked_req_hashesK  s     ""::T:22 88??$&&88##%%-// }}S]].  zzz/B=?BrE   c                    U R                   (       a  [        R                  S5        g U R                  (       a  [        R                  S5        g U R	                  U5      =(       d    U R                  UR                  5      $ )Nz9Metadata-only fetching is not used in the legacy resolverz?Metadata-only fetching is not used as hash checking is required)r   ry   debugr   $_fetch_metadata_using_link_data_attr _fetch_metadata_using_lazy_wheelr;   r   s     r9   _fetch_metadata_only(RequirementPreparer._fetch_metadata_onlyk  sk     LLK LLQ 88
 =22388<	=rE   c                    UR                   R                  5       nUc  gUR                  c   e[        R	                  SUR                  U5        [        UU R                  UR                  5       S9n[        UR                  S5       nUR                  5       nSSS5        [        WUR                   R                  UR                  R                  5      n[        UR                  5      [        UR                  R                  5      :w  a,  [!        USUR                  R                  UR                  5      eU$ ! , (       d  f       N= f)zGFetch metadata from the data-dist-info-metadata attribute, if possible.Nz/Obtaining dependency information for %s from %srl   rbName)r;   metadata_linkr-   ry   verboserg   r   	as_hashesopenrI   readr   rw   namer	   raw_namer   )rO   r-   r   metadata_filefmetadata_contentsmetadata_dists          r9   r   8RequirementPreparer._fetch_metadata_using_link_data_attr~  s    ..0 ww"""=GG	
 %NN **,

 -$$d+q ! , 2HHGGLL
 ]3348I#'',,8WW&VSWW\\=+A+A  % ,+s   D::
Er;   c                    U R                   (       d  gUR                  (       d  UR                  (       d  [        R	                  SU5        g[        UR                  5      n[        UR                  5      n[        R                  SUUR                  5        UR                  R                  SS5      S   n [        X4U R                  5      $ ! [         a    [        R	                  SU5         gf = f)z-Fetch metadata using lazy wheel, if possible.Nz=Lazy wheel is not used as %r does not point to a remote wheelz+Obtaining dependency information from %s %s#   r   z"%s does not support range requests)r   ro   rp   ry   r   r   rw   r	   r   rz   versionr?   splitr   r   r   )rO   r;   wheelr   r?   s        r9   r   4RequirementPreparer._fetch_metadata_using_lazy_wheel  s     ""<<t}}LLO dmm$ ,9MM	

 hhnnS!$Q'	&t$--@@* 	LL=sC	s   7C  C0/C0partially_downloaded_reqsc                    [        SSS9R                  n0 nU H$  nUR                  (       d   eXTUR                  '   M&     U R                  UR	                  5       U5      nU Hw  u  nu  p[
        R                  SXx5        XG   nXl        XR                  UR                  R                  '   UR                  (       a  M]  UR                  [        U5      5        My     U H  nU R                  XR5        M     g)z>Download any requirements which were only fetched by metadata.rB   Tr_   zDownloading link %s to %sN)r*   rI   r;   r   keysry   r   local_file_pathr   r?   rp   needs_unpacked_archiver   _prepare_linked_requirement)
rO   r   r   rd   links_to_fully_downloadr-   batch_downloadr;   filepath_s
             r9   _complete_partial_requirements2RequirementPreparer._complete_partial_requirements  s     !hFKK
 CE,C88O803CHH- - --#((*
 $2D-8LL4dE)/C #+ .6SXX\\* <<<**4>: $2& -C,,SB -rE   c                 "   UR                   (       d   eU R                  U5        [        5          SnU R                  b[  UR                   R                  (       a@  U R                  U5      n[        UR                   U R                  UUR                  (       + S9nUb#  X0R                  UR                   R                  '   O&U R                  U5      nUb  SUl        UsSSS5        $ U R                  X5      sSSS5        $ ! , (       d  f       g= f)z3Prepare a requirement to be obtained from req.link.N)rs   T)r;   r   r%   r\   rp   r   rb   r   r   r?   r   needs_more_preparationr   )rO   r-   r   ri   r]   r   s         r9   prepare_linked_requirement.RequirementPreparer.prepare_linked_requirement  s     xxx  %\ I  ,1B1B44S9/HH%% /2.E.E*E	 $1:  . !% 9 9# > ,15C.(7 \< 33CI= \\s   B-D &D  
Dreqsc                     U Vs/ s H  o3R                   (       d  M  UPM     nnU H  nU R                  c  M  UR                  R                  (       d  M/  U R	                  U5      n[        UR                  U R                  U5      nUc  Mf  XPR                  UR                  R                  '   SUl         M     / nU H8  nUR                   (       a  UR                  U5        M'  U R                  X25        M:     U R                  UUS9  gs  snf )z,Prepare linked requirements more, if needed.NF)r   )r   r\   r;   rp   r   rb   r   r?   appendr   r   )rO   r   r   r-   r]   ri   r   s          r9    prepare_linked_requirements_more4RequirementPreparer.prepare_linked_requirements_more  s      $Bt'A'AtBC  ,1B1B1B44S9/$:K:KVT	(5>$$SXX\\216C.  ?A!C)))00500F	  	++%+ 	, 	
+ Cs
   DDc           	      n   UR                   (       d   eUR                   nU R                  U5      nU(       a  UR                  (       a  UR                  c   eUR                  (       d   eUR
                  (       d   e[        UR                  R                  [        5      (       a\  UR                  R                  R                  (       a7  UR                  UR                  R                  R                  5      (       a  S nO2[        R                  S5        UR                  Ul         UR                   nU R                  X5        UR                  5       (       a  S nOUR                   U R"                  ;  a:   [%        UUR&                  U R(                  U R*                  U R,                  U5      nO;U R"                  UR                      nU(       a  UR3                  U5        [5        US S9nUR                  c  UR6                  (       a   e[9        X1R&                  5      Ul        [        UR                  R                  [        5      (       ap  UR                  R                  R                  (       dK  U(       aD  [;        UR<                  5      S   R?                  5       nSU 3UR                  R                  l         U(       a  UR<                  Ul!        [E        UU RF                  U RH                  U RJ                  U RL                  5      n	U	$ ! [.         a  n[1        SU SU SU 35      eS nAff = f)NzyThe hashes of the source archive found in cache entry don't match, ignoring cached built wheel and re-downloading source.zCould not install requirement z because of HTTP error z	 for URL rR   r   zsha256=)'r;   r   r   download_inforp   ro   r   rz   r   r]   
has_one_ofry   r{   cached_wheel_source_linkr   rn   r?   r   rr   r   r   r=   r\   r   r   rc   rG   editabler"   r'   rI   	hexdigesthashr   r:   r.   r/   r0   r1   )
rO   r-   r   r;   r]   
local_fileexcri   r   dists
             r9   r   /RequirementPreparer._prepare_linked_requirement4  s    xxxxx,,S1c--$$000== =<<< 3,,11;??%%**11%%c&7&7&<&<&C&CDD 1
 77xx%%c;!!JXXT---'NNNNNN%%
 ((2I)))4id;J $ ||## 4T>> JC 3,,11;??))..55 1!4>>@ 18v.>!!&&+ ",//C)KK  !!
 W * '4SE : E4&2 s   98L 
L4L//L4c                    U R                   c   eUR                  c   eUR                  nUR                  (       d&  UR                  5       (       a-  UR                  (       a  UR                  U R                   5        g UR                  5       (       a  [        R                  SU5        g UR                  c  g [        R                  R                  U R                   UR                  5      n[        R                  R                  U5      (       dC  [        R                  " UR                  U5        [!        U5      n[        R#                  SU5        g g )NzENot copying link to destination directory since it is a directory: %szSaved %s)r\   r;   rm   rn   r   archivery   r   r   ru   rI   rv   rw   rx   shutilcopyr&   rz   )rO   r-   r;   download_locationr}   s        r9   save_linked_requirement+RequirementPreparer.save_linked_requirement  s      ,,,xx###xx;;4//11cllKK))*!!LL.
 &GGLL):):DMMJww~~/00KK++->?():;MKK
M2 1rE   c                 @   UR                   (       d   S5       e[        R                  SU5        [        5          U R                  (       a  [        SU S35      eUR                  U R                  5        UR                  5         UR                  (       d   e[        UR                  5      Ul        [        UU R                  U R                  U R                   U R"                  5      nUR%                  U R&                  5        SSS5        U$ ! , (       d  f       W$ = f)z Prepare an editable requirement.z-cannot prepare a non-editable req as editablezObtaining %szThe editable requirement zT cannot be installed when requiring hashes, because there is no single file to hash.N)r   ry   rz   r%   r   r   r   r   update_editabler   r!   unpacked_source_directoryr   r:   r.   r/   r0   r1   check_if_existsr   )rO   r-   r   s      r9   prepare_editable_requirement0RequirementPreparer.prepare_editable_requirement  s    
 ||LLL|NC(\""'/u 5  
 %%dll3!>>!> 78U8U VC-""$$%%D  2 23) , - \, s   CD
Dskip_reasonc                 ~   UR                   (       d   S5       eUc   SUR                    35       e[        R                  SX!UR                   R                  5        [	        5          U R
                  (       a  [        R                  S5        [        U5      R                  5       sSSS5        $ ! , (       d  f       g= f)z)Prepare an already-installed requirement.z(req should have been satisfied but isn'tNz?did not get skip reason skipped but req.satisfied_by is set to zRequirement %s: %s (%s)zSince it is already installed, we are trusting this package without checking its hash. To ensure a completely repeatable environment, install into an empty virtualenv.)	satisfied_byry   rz   r   r%   r   r   r   r   )rO   r-   r   s      r9   prepare_installed_requirement1RequirementPreparer.prepare_installed_requirement  s     K!KK& 	
))*,	
& 	%{9I9I9Q9Q	
 \""( )-GGI \\s   %?B..
B<)r   r   r   r   r   r   r0   r.   r1   r\   r/   r   r   r   r   r   r=   )F)!rS   rT   rU   rV   __doc__rW   r   boolr   r   r   intr   r   r   r   r#   r   r   r   r   r   r   r   r   r   r   r   r   r   r   rY   __classcell__)r   s   @r9   r   r      sP    9595 sm95 	95
 95 95 $95 95 95 95 95 95 95 95 95  !95" 
#95vB'9 Bd B6.%.8<.	..C*< C C@== 
"	#=&'' 
"	#'R 
"	#@ !&*C#+,>#?*C *C 
	*CZ @E$J%$J8<$J	$JN KP
/0
CG
	
<Z%Z8<Z	Zx3+= 3$ 34 
BJJ J 
	J JrE   r   )NN)T)Tr   rL   ru   r   dataclassesr   pathlibr   typingr   r   r   r   pip._vendor.packaging.utilsr	   pip._internal.distributionsr
   %pip._internal.distributions.installedr   pip._internal.exceptionsr   r   r   r   r   r   r   "pip._internal.index.package_finderr   pip._internal.metadatar   r   pip._internal.models.direct_urlr   pip._internal.models.linkr   pip._internal.models.wheelr   pip._internal.network.downloadr   r    pip._internal.network.lazy_wheelr   r   pip._internal.network.sessionr   ,pip._internal.operations.build.build_trackerr   pip._internal.req.req_installr   pip._internal.utils._logr    &pip._internal.utils.direct_url_helpersr!   r"   pip._internal.utils.hashesr#   r$   pip._internal.utils.loggingr%   pip._internal.utils.miscr&   r'   r(   r)   pip._internal.utils.temp_dirr*   pip._internal.utils.unpackingr+   pip._internal.vcsr,   rS   ry   r   r:   rW   r   rD   rG   rg   rj   rr   rb   r   rZ   rE   r9   <module>r     s+   .
  	  !  1 1 9 Q G   = N 7 * , F 5 E < . = 2  7 5 !	8	5	55 5 	5
 5 5$N$ N# N# N$ N   " #'#	)
)) 3-) V	)
 
)2 PT!
!&sm!<DV<L!	!: #'#(
(( ( 	(
 3-( V( d^(^ #'	
 V  	
 c]<FJ FJrE   