"Jd" .dZddlZddlZddlZddlZddlZddlZddlmZm Z m Z ddlm Z ddl m Z ddlmZmZmZmZddlmZejeZeezZ ddlZeez Zn #e$redYnwxYw ddlZeez Zn #e$red YnwxYwd efd Zd ed e efd Z deed e!fdZ"deded e!fdZ#d ed dfdZ$de d e!fdZ%ddedede!d dfdZ&deded dfdZ' ddedede ed dfdZ(dS) zUtilities related archives. N)IterableListOptional)ZipInfo)InstallationError)BZ2_EXTENSIONSTAR_EXTENSIONS XZ_EXTENSIONSZIP_EXTENSIONS) ensure_dirzbz2 module is not availablezlzma module is not availablereturncVtjd}tj||S)zBGet the current umask which involves having to set it temporarily.r)osumask)masks P/opt/alt/python311/lib/python3.11/site-packages/pip/_internal/utils/unpacking.py current_umaskr+s! 8A;;DHTNNN Kpathc*|dd}d|vrJd|vr,|d|dksd|vr|ddSd|vr|ddS|dgS)N/\)lstripfindsplitrs rsplit_leading_dirr2s ;;s   " "4 ( (D d{{ $))C..499T??::t4?O?Ozz#q!!! zz$"""bzrpathsc^d}|D]'}t|\}}|sdS||}||krdS(dS)zyReturns 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_prefixrprefixrests rhas_leading_dirr%>saM(..  55  ""MM } $ $55% 4r directorytargetctj|}tj|}tj||g}||kS)zL Return true if the absolute path of target is within the directory )rrabspath commonprefix)r&r' abs_directory abs_targetr#s ris_within_directoryr-MsOGOOI..M((J W ! !=*"= > >F ] ""rcVtj|dtzdzdS)zx Make file present at path have execute for user/group/world (chmod +x) is no-op on windows per python docs iIN)rchmodrrs r2set_extracted_file_to_default_mode_plus_executabler1Xs- HTE]__,,u466666rinfocf|jdz }t|otj|o|dzS)Nr/) external_attrboolstatS_ISREG)r2modes rzip_item_is_executabler:`s7   #D <d++<u = ==rTfilenamelocationflattenc|t|t|d} tj|d}t |o|}|D]}|j}|}|rt|d}tj ||}tj |} t||s&d} t| ||||ds|drt|t| ||} t|d5} t#j| | d d d n #1swxYwY| t)|rt+|h#| t)|rt+|wwxYw |d S#|wxYw) 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) allowZip64rzQThe zip file ({}) has a file ({}) trying to install outside target directory ({})rrwbN)r openzipfileZipFiler%namelistinfolistr;rrrjoindirnamer-rformatendswithshutil copyfileobjcloser:r1) r;r<r=zipfpzipleadingr2namefndirmessagefpdestfps r unzip_filerWgsXx 4 E oe555!#,,..11=gLLNN O OD=DB 0&t,,Q/h++B'//"%%C&x44 P4(xX(N(NOOO{{3 O2;;t#4#4 O23XXd^^Ob$76*2v666777777777777777HHJJJ-d33OJ2NNNHHJJJ-d33OJ2NNNNO5 O:   sHEH%%G5F GF GF G"4H%5H  H%%H;c.t||ds'|drd}n|trd}nv|trd}nG|drd}nt d|d }tj||d } td | D}| D]}|j }|rt|d }tj||}t!||s&d}t#|||||rt||rQ |||#t,$r,} t d||j | Yd} ~ d} ~ wwxYw ||} nA#t0t2f$r-} t d||j | Yd} ~ Pd} ~ wwxYwttj|| Jt|d5} t7j| | dddn #1swxYwY| ||||jdzrtA| |dS#|wxYw)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 after being written. Note that for windows, any execute changes using os.chmod are no-ops per the python docs. z.gzz.tgzzr:gzzr:bz2zr:xzz.tarrz-Cannot determine compression type for file %szr:*zutf-8)encodingcg|] }|j S)rQ).0members r zuntar_file..s"N"N"N66;"N"N"NrrzQThe tar file ({}) has a file ({}) trying to install outside target directory ({})z/In the tar file %s the member %s is invalid: %sNrAr/)!r lowerrJrr loggerwarningtarfilerBr% getmembersrQrrrrGr-rrIisdirissym_extract_member Exception extractfileKeyErrorAttributeErrorrHrKrLrMutimer9r1) r;r<r9tarrPr^rRrrTexcrUrVs r untar_filerosx~~  '' 8>>+;+;+D+DV+L+L     " "> 2 2     " "= 1 1     " "6 * * ;     ,x 8 8 8C5!"N"NS^^=M=M"N"N"NOOnn&&1 M1 MFB .&r**1-7<<"--D&x66 R4(xx(P(PQQQ||~~& M4    $ M ''5555   NNI    HHHH  00BB .1   NNI    HHHH 27??400111~~~$%%3&r6222333333333333333  &$''';&MFtLLLc1 Mf  sC.M> H$#M>$ I."IM>IM>I43M>4J2"J-'M>-J22AM>5L M>L M>L AM>>N content_typecJtj|}|dks@|t st j|r(t|||d dS|dksPtj |s<|ttztzrt||dStd|||t#d|)Nzapplication/zipz.whl)r=zapplication/x-gzipzZCannot unpack file %s (downloaded from %s, content-type: %s); cannot detect archive formatz#Cannot determine archive format of )rrrealpathr`rJr rC is_zipfilerWrc is_tarfiler rr roracriticalr)r;r<rps r unpack_filervs& w))H))) >>   $ $^ 4 4 *  h ' ' * 8X83D3DV3L3L/LMMMMMM,,,  h ' ' - >>   $ $^n%D}%T U U - 8X&&&&&  +        Ph P PQQQr)T)N))__doc__loggingrrKr7rcrCtypingrrrrpip._internal.exceptionsrpip._internal.utils.filetypesrr r r pip._internal.utils.miscr getLogger__name__raSUPPORTED_EXTENSIONSbz2 ImportErrordebuglzmaintrstrrr6r%r-r1r:rWrorvr\rrrs. ++++++++++666666 0/////  8 $ $&60JJJN*000 LL./////01KKKM)111 LL/000001s C DI     8C= T    #3######7S7T7777>>T>>>>++++d+d++++\NNNNNNNh#'RRRR3-R RRRRRRs$ A##B?B BB+*B+