7f. hdZddlZddlZddlZddlZddlZddlZddlZddlm Z m Z m Z ddlm Z ddl mZddlmZmZmZmZddlmZejeZeezZ ddlZeez Zn #e$redYnwxYw ddlZeez Zn #e$red YnwxYwd efd Zd e d e e fd Z!de e d e"fdZ#de de d e"fdZ$d efdZ%d e d dfdZ&de d e"fdZ'd"de de de"d dfdZ(de de d dfdZ)de de dej*de"d df dZ+ d#de de d e e d dfd!Z,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 }/builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/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_dirr3s ;;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-NsOGOOI..M((J W ! !=*"= > >F ] ""rc,dtzdzS)NiI)rrr!_get_default_mode_plus_executabler1Ys MOO# #e ++rcHtj|tdS)zx Make file present at path have execute for user/group/world (chmod +x) is no-op on windows per python docs N)rchmodr1rs r2set_extracted_file_to_default_mode_plus_executabler4]s# HT46677777rinfocf|jdz }t|otj|o|dzS)Nr/) external_attrboolstatS_ISREG)r5modes rzip_item_is_executabler=es7   #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=r4) r>r?r@zipfpzipleadingr5namefndirmessagefpdestfps r unzip_filerZlsXx 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 tds'drd}ntrd}nvtrd}nGdrd}nt dd }tj|d } td | D} tj t |rm| D]X}t|j\}}||_|r$t|j\}} ||kr| |_Yd tjdt$dtjf fd } || n"#t($rt+||YnwxYw|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 on top of the default. 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 Sr0)rT).0members r zuntar_file..s"N"N"N66;"N"N"Nrr`rr c|j} |}nB#tj$r0tjdddvrtj|}nYnwxYwn<#tj$r*}d}t||d}~wwxYw| r |dzr|_nd|_|S)N>rcrc rfrc rc z%Invalid member in the tar file {}: {}r/) r<tarfileLinkOutsideDestinationErrorsys version_info tar_filterTarErrorrrLisfile) r`r orig_modeexcrW data_filterdefault_mode_plus_executabler>r?s r pip_filterzuntar_file..pip_filters "K "!,VX!>!>">"""+BQB/4&-%7%I%IFF!#F"'   EG,$ ==??'y5'8'">FKK #'FK s2 Ar?r<tarrSr` name_lead name_restlnk_leadlnk_restrzrxrys `` @@r untar_filersx~~  '' 8>>+;+;+D+DV+L+L     " "> 2 2     " "= 1 1     " "6 * * ;     ,x 8 8 8CD!"N"NS^^=M=M"N"N"NOO ; 8!-K,M+N+N ( 7"nn..77F+v-O-O*(#y00.6FO& 7?& #& '/& & & & & & & & & P NN8JN 7 7 7 7s D D D !(Hc7 C C C C C Dx  s1"+I HB=IH63I5H66II%rrScB|D]}|j}|rt|d}tj||}t ||s&d}t||||| rt|| rQ | ||#t$r,}td||j|Yd}~d}~wwxYw ||} nA#t"t$f$r-}td||j|Yd}~Pd}~wwxYwttj|| Jt)|d5} t+j| | dddn #1swxYwY| ||||jdzrt5| dS)z/Fallback for Python without tarfile.data_filterrzQThe tar file ({}) has a file ({}) trying to install outside target directory ({})z/In the tar file %s the member %s is invalid: %sNrDr/)rrTrrrrJr-rrLisdirr issym_extract_member Exceptionr}r~ extractfileKeyErrorrrKrErNrOrPutimer<r4) r>r?rrSr`rUrrWrwrXrYs rrrs..""0I0I [  *"2&&q)Bw||Hb))"8T22 N0 $GNN8T8$L$LMM M <<>>% I t     \\^^# I ##FD1111   EK    __V,,n-   EK    rwt,, - - ->>>dD!! /V"2v... / / / / / / / / / / / / / / / HHJJJ IIfd # # #{U" IB4HHHa0I0IsBC D&"D  DD,,E*="E%%E*-GG G 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|rMr rF is_zipfilerZro is_tarfiler rr rr}criticalr)r>r?rs r unpack_filer5s& w))H))) >>   $ $^ 4 4 *  h ' ' * 8X83D3DV3L3L/LMMMMMM,,,  h ' ' - >>   $ $^n%D}%T U U - 8X&&&&&  +        Ph P PQQQr)T)N)-__doc__loggingrrNr:rqrorFtypingrrrrpip._internal.exceptionsrpip._internal.utils.filetypesrr r r pip._internal.utils.miscr getLogger__name__r}SUPPORTED_EXTENSIONSbz2 ImportErrordebuglzmaintrrrr9r%r-r1r4r=rZrTarFilerrr0rrrs ++++++++++666666 0/////  8 $ $&60JJJN*000 LL./////01KKKM)111 LL/000001s C DI     8C= T    #3######,3,,,,8S8T8888>>T>>>>++++d+d++++\^^^^^^^B7I7I7I 7I 7I  7I7I7I7Iz#'RRRR3-R RRRRRRs$ A''BB BB/.B/