
    q"h.              
       l   S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKJ	r	J
r
J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  \R,                  " \5      r\\-   r SSKr\\-  r SSKr\\-  rS
\4S jrS\ S
\
\    4S jr!S\	\    S
\"4S jr#S\ S\ S
\"4S jr$S
\4S jr%S\ S
S4S jr&S\S
\"4S jr'S!S\ S\ S\"S
S4S jjr(S\ S\ S
S4S jr)S\ S\ S\RT                  S\"S
S4
S jr+ S"S\ S\ S\\    S
S4S  jjr,g! \ a    \R9                  S5         Nf = f! \ a    \R9                  S	5         Nf = f)#zUtilities related archives.    N)IterableListOptional)ZipInfo)InstallationError)BZ2_EXTENSIONSTAR_EXTENSIONSXZ_EXTENSIONSZIP_EXTENSIONS)
ensure_dirzbz2 module is not availablezlzma module is not availablereturnc                  ^    [         R                  " S5      n [         R                  " U 5        U $ )zBGet the current umask which involves having to set it temporarily.r   )osumask)masks    O/var/www/html/env/lib/python3.13/site-packages/pip/_internal/utils/unpacking.pycurrent_umaskr   +   s    88A;DHHTNK    pathc                 
   U R                  S5      R                  S5      n SU ;   aB  SU ;   a$  U R                  S5      U R                  S5      :  d  SU ;  a  U R                  SS5      $ SU ;   a  U R                  SS5      $ U S/$ )N/\    )lstripfindsplitr   s    r   split_leading_dirr   2   sz    ;;s""4(D
d{	$))C.499T?:t4?Ozz#q!!	zz$""bzr   pathsc                 b    SnU  H'  n[        U5      u  p4U(       d    gUc  UnM   X1:w  d  M'    g   g)zuReturns true if all the paths have the same leading path name
(i.e., everything is in one subdirectory in an archive)NFT)r   )r    common_prefixr   prefixrests        r   has_leading_dirr%   >   s>     M(.""M$  r   	directorytargetc                     [         R                  R                  U 5      n[         R                  R                  U5      n[         R                  R                  X#/5      nXB:H  $ )zD
Return true if the absolute path of target is within the directory
)r   r   abspathcommonprefix)r&   r'   abs_directory
abs_targetr#   s        r   is_within_directoryr-   M   sH     GGOOI.M(JWW!!="=>F""r   c                  $    S[        5       ) -  S-  $ )Ni  I   )r    r   r   !_get_default_mode_plus_executabler1   X   s    MO##e++r   c                 B    [         R                  " U [        5       5        g)zl
Make file present at path have execute for user/group/world
(chmod +x) is no-op on windows per python docs
N)r   chmodr1   r   s    r   2set_extracted_file_to_default_mode_plus_executabler4   \   s    
 HHT467r   infoc                     U R                   S-	  n[        U=(       a"    [        R                  " U5      =(       a    US-  5      $ )N   r/   )external_attrboolstatS_ISREG)r5   modes     r   zip_item_is_executabler=   d   s6    #D <d+<u==r   filenamelocationflattenc                    [        U5        [        U S5      n [        R                  " USS9n[	        UR                  5       5      =(       a    UnUR                  5        GHA  nUR                  nUnU(       a  [        U5      S   n[        R                  R                  X5      n[        R                  R                  U5      n	[        X5      (       d  Sn
[        U
R                  XU5      5      eUR!                  S5      (       d  UR!                  S5      (       a  [        U5        M  [        U	5        UR                  U5      n [        US5       n["        R$                  " X5        S	S	S	5        UR'                  5         [)        U5      (       a  [+        U5        GMA  GMD     UR'                  5         g	! , (       d  f       NR= f! UR'                  5         [)        U5      (       a  [+        U5        f f = f! UR'                  5         f = f)
a  
Unzip the file (with path `filename`) to the destination `location`.  All
files are written based on system defaults and umask (i.e. permissions are
not preserved), except that regular file members with any execute
permissions (user, group, or world) have "chmod +x" applied after being
written. Note that for windows, any execute changes using os.chmod are
no-ops per the python docs.
rbT)
allowZip64r   zQThe zip file ({}) has a file ({}) trying to install outside target directory ({})r   r   wbN)r   openzipfileZipFiler%   namelistinfolistr>   r   r   r   joindirnamer-   r   formatendswithshutilcopyfileobjcloser=   r4   )r>   r?   r@   zipfpzipleadingr5   namefndirmessagefpdestfps                r   
unzip_filerZ   k   s    x4 E ooe5!#,,.1=gLLND==DB&t,Q/h+B''//"%C&x444  (xX(NOO{{32;;t#4#423 XXd^Ob$6**26 ( HHJ-d33J2N 45 #: 	 ( HHJ-d33J2N 4 	s<   D.G9 GF7+G33G9 7
G	G.G66G9 9Hc                   ^ ^^^ [        T5        T R                  5       R                  S5      (       d$  T R                  5       R                  S5      (       a  SnOT R                  5       R                  [        5      (       a  SnOjT R                  5       R                  [        5      (       a  SnO?T R                  5       R                  S5      (       a  SnO[
        R                  ST 5        S	n[        R                  " T US
S9n [        UR                  5        Vs/ s H  oDR                  PM     sn5      n [        R                  m[        5       mU(       ao  UR                  5        H[  n[        UR                  5      u  pgXtl        UR                  5       (       d  M7  [        UR                   5      u  pX:X  d  MU  Xl        M]     S[        R"                  S[$        S[        R"                  4UUU U4S jjn
UR'                  TU
S9  UR-                  5         gs  snf ! [(         a    [+        T TX55         N/f = f! UR-                  5         f = f)a  
Untar the file (with path `filename`) to the destination `location`.
All files are written based on system defaults and umask (i.e. permissions
are not preserved), except that regular file members with any execute
permissions (user, group, or world) have "chmod +x" applied on top of the
default.  Note that for windows, any execute changes using os.chmod are
no-ops per the python docs.
z.gzz.tgzzr:gzzr:bz2zr:xzz.tarrz-Cannot determine compression type for file %szr:*zutf-8)encodingmemberr   r   c                   > U R                   n  T" U T5      n U R                  5       (       a  US-  (       a	  TU l         U $ S U l         U $ ! [        R                   a2    [        R                  S S S;   a  [        R
                  " U T5      n  Nue f = f! [        R                   a"  nSn[        UR                  TU5      5      eS nAff = f)N   >   r`   	      r`   
      r`         z%Invalid member in the tar file {}: {}r/   )
r<   tarfileLinkOutsideDestinationErrorsysversion_info
tar_filterTarErrorr   rL   isfile)	r^   r   	orig_modeexcrW   data_filterdefault_mode_plus_executabler>   r?   s	        r   
pip_filteruntar_file.<locals>.pip_filter   s    "KK	"!,VX!>2 ==??y5'8">FK  #'FKA #>> "++BQ/ 4  &-%7%7%IF!" '' 	EG ,$ 		s0   	A
 
ABB BB C	'CC	)filterN)r   lowerrM   r   r
   loggerwarningrj   rE   r%   
getmembersrT   rs   r1   r   islnklinknameTarInfostr
extractallAttributeError_untar_without_filterrP   )r>   r?   r<   tarr^   rS   	name_lead	name_restlnk_leadlnk_restru   rs   rt   s   ``         @@r   
untar_filer      s    x~~  ''8>>+;+D+DV+L+L			"	">	2	2			"	"=	1	1			"	"6	*	*;	
 
,,x
8CC!S^^=M"N=M6;;=M"NO
:	8!--K ,M+N( "nn.F+<V[[+I(I"+K||~~->v-O*#0.6O /%7?? %# %'// % %N NN8JN7 			E #O  	D!(HcC	Dv 			sP   H? H3H? ;H" AH? #H? AH? H? "H<9H? ;H<<H? ?Ir   rS   c                    UR                  5        GHi  nUR                  nU(       a  [        U5      S   n[        R                  R                  X5      n[        X5      (       d  Sn[        UR                  XU5      5      eUR                  5       (       a  [        U5        M  UR                  5       (       a   UR                  XF5        M   UR!                  U5      n	[        [        R                  R'                  U5      5        U	c   e[)        US5       n
[*        R,                  " X5        SSS5        U	R/                  5         UR1                  XF5        UR2                  S-  (       d  GM^  [5        U5        GMl     g! [         a.  n[        R                  SU UR                  U5         SnAGM  SnAff = f! ["        [$        4 a.  n[        R                  SU UR                  U5         SnAGM  SnAff = f! , (       d  f       N= f)z/Fallback for Python without tarfile.data_filterr   zQThe tar file ({}) has a file ({}) trying to install outside target directory ({})z/In the tar file %s the member %s is invalid: %sNrD   r/   )r{   rT   r   r   r   rJ   r-   r   rL   isdirr   issym_extract_member	Exceptionry   rz   extractfileKeyErrorr   rK   rE   rN   rO   rP   utimer<   r4   )r>   r?   r   rS   r^   rU   r   rW   rr   rX   rY   s              r   r   r      s    .."[["2&q)Bww||H)"8220  $GNN88$LMM<<>>t\\^^##F1__V, rwwt,->!>dD!V""2. "HHJIIf#{{U""B4Ha #   	 EKK	 	 n- 	 EKK	 	 "!s<   :F F;G< 
F8
"F33F8;G9"G44G9<
H
	content_typec                 "   [         R                  R                  U 5      n US:X  dC  U R                  5       R	                  [
        5      (       d  [        R                  " U 5      (       a  [        XU R	                  S5      (       + S9  g US:X  dQ  [        R                  " U 5      (       d6  U R                  5       R	                  [        [        -   [        -   5      (       a  [        X5        g [        R!                  SU UU5        [#        SU 35      e)Nzapplication/zipz.whl)r@   zapplication/x-gzipzZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formatz#Cannot determine archive format of )r   r   realpathrx   rM   r   rF   
is_zipfilerZ   rj   
is_tarfiler	   r   r
   r   ry   criticalr   )r>   r?   r   s      r   unpack_filer   3  s    
 ww)H))>>$$^44h''883D3DV3L/LM,,h''>>$$^n%D}%TUU8& 	+	
  "EhZ PQQr   )T)N)-__doc__loggingr   rN   r:   rl   rj   rF   typingr   r   r   r   pip._internal.exceptionsr   pip._internal.utils.filetypesr   r	   r
   r   pip._internal.utils.miscr   	getLogger__name__ry   SUPPORTED_EXTENSIONSbz2ImportErrordebuglzmaintr   r   r   r9   r%   r-   r1   r4   r=   rZ   r   TarFiler   r   r0   r   r   <module>r      s   !  	   
   + +  6  0			8	$ &6 0N*1M)
s 	C 	DI 	8C= T #3 # # #,3 ,8S 8T 8> >T >+ + +d +d +\] ] ] ]@7I7I7I 
7I 	7I
 
7Iz #'RRR 3-R 
	Ri  0
LL./0  1
LL/01s$   	C< )	D <DDD32D3