grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026a XC?h&Ïã@sndZddlZddlZddlZddlZddlZddlZzddlZ[dZWne y\dZYn0zddl Z [ dZ Wne y†dZ Yn0zddl Z [ dZ Wne y°dZ Yn0zddlmZWne yØdZYn0zddlmZWne �ydZYn0ejdkZdZZejdk�r,ddlZne�r:ddlZe�rDd nd Zeed ƒ�o^ej d ¡ae�oneed ƒZdZgd¢ZGdd„deƒZGdd„deƒZ Gdd„deƒZ!Gdd„deƒZ"Gdd„deƒZ#Gdd„de$ƒZ%Gdd„de$ƒZ&dd„Z'd d!„Z(efd"d#„Z)d¤d$d%„Z*d&d'„Z+d(d)„Z,d*d+„Z-dd,œd-d.„Z.dd,œd/d0„Z/eed1ƒ�rbdd,œd2d3„Z0nd4d3„Z0dd,œd5d6„Z1dd,œd7d8„Z2dd,œd9d:„Z3d;d<„Z4d¥d=d>„Z5dde3ddfd?d@„Z6eej7dAƒ�rÚdBdC„Z8dDdE„Z9ndFdC„Z8dGdE„Z9dHdI„Z:dJdK„Z;ejhej?k�o.ej@ejAv�o.ejejBvZCd¦dLdM„ZDeCeD_EdNdO„ZFe3fdPdQ„ZGdRdS„ZHdTdU„ZIdVdW„ZJdXdY„ZKd§d[d\„ZLd¨d]d^„ZMd_eLd`gdafiZNe�r¼eLdbgdcfeNdd<eMgdefeNdf<e �rÒeLdggdhfeNdi<e �rèeLdjgdkfeNdl<dmdn„ZOd©dpdq„ZPdrds„ZQdªdtdu„ZRdvdw„ZSdxdy„ZTd«dzd{„ZUd|d}„ZVd~d„ZWd€d�„ZXdd‚œdƒd„„ZYd…geYgdafd†geXgdefd‡œZZe�r„dˆd‰geYgdcfeZdd<e �rždŠd‹geYgdhfeZdi<e �r¸dŒd�geYgdkfeZdl<dŽd�„Z[d¬dd‚œd�d‘„Z\eed’ƒ�re ]d“¡e ^d”d•¡Z_d–e_j`_d—e_ja_d˜e_jb_d™d“„Zcn$e�r8e ]d“¡e ^d”d•¡Z_dšd“„Zcd­d›dœ„Zdd®dždŸ„Zed d¡„ZfejgejhBdfd¢d£„ZidS)¯z—Utility functions for copying and archiving files and directory trees. XXX The functions here don't copy the resource fork or other metadata on Mac. éNTF)Úgetpwnam)ÚgetgrnamÚntÚposixiiÚsendfileZlinuxÚ _fcopyfilez%.COM;.EXE;.BAT;.CMD;.VBS;.JS;.WS;.MSC)Ú copyfileobjÚcopyfileÚcopymodeÚcopystatÚcopyÚcopy2ÚcopytreeÚmoveÚrmtreeÚErrorÚSpecialFileErrorÚ ExecErrorÚ make_archiveÚget_archive_formatsÚregister_archive_formatÚunregister_archive_formatÚget_unpack_formatsÚregister_unpack_formatÚunregister_unpack_formatÚunpack_archiveÚignore_patternsÚchownÚwhichÚget_terminal_sizeÚ SameFileErrorc@s eZdZdS)rN)Ú__name__Ú __module__Ú __qualname__©r$r$ú+/opt/alt/python39/lib64/python3.9/shutil.pyrEsrc@seZdZdZdS)r z5Raised when source and destination are the same file.N©r!r"r#Ú__doc__r$r$r$r%r Hsr c@seZdZdZdS)rz|Raised when trying to do a kind of operation (e.g. copying) which is not supported on a special file (e.g. a named pipe)Nr&r$r$r$r%rKsrc@seZdZdZdS)rz+Raised when a command could not be executedNr&r$r$r$r%rOsrc@seZdZdZdS)Ú ReadErrorz%Raised when an archive cannot be readNr&r$r$r$r%r(Rsr(c@seZdZdZdS)Ú RegistryErrorzVRaised when a registry operation with the archiving and unpacking registries failsNr&r$r$r$r%r)Usr)c@seZdZdZdS)Ú_GiveupOnFastCopyzuRaised as a signal to fallback on using raw read()/write() file copy when fast-copy functions fail to do so. Nr&r$r$r$r%r*Ysr*c Cs°z| ¡}| ¡}Wn,ty@}zt|ƒ‚WYd}~n d}~00zt |||¡WnVtyª}z>|j|_|j|_|j t j t j hvr�t|ƒ‚n|d‚WYd}~n d}~00dS)zhCopy a regular file content or metadata by using high-performance fcopyfile(3) syscall (macOS). N) ÚfilenoÚ Exceptionr*rrÚOSErrorÚnameÚfilenameÚ filename2ÚerrnoÚEINVALÚENOTSUP)ÚfsrcÚfdstÚflagsÚinfdÚoutfdÚerrr$r$r%Ú_fastcopy_fcopyfile^s  r:c CsFz| ¡}| ¡}Wn,ty@}zt|ƒ‚WYd}~n d}~00ztt |¡jdƒ}Wntynd}Yn0tj dkr„t |dƒ}d}zt  ||||¡}WnŒt�y(}zr|j |_ |j |_|jtjkrÖdat|ƒ‚|jtjkrè|d‚|dk�rt |dtj¡dk�rt|ƒ‚|‚WYd}~qˆd}~00|dk�r8�qB||7}qˆdS)z˜Copy data from one regular mmap-like fd to another by using high-performance sendfile(2) syscall. This should work on Linux >= 2.6.33 only. Ni€ili@rF)r+r,r*ÚmaxÚosÚfstatÚst_sizer-ÚsysÚmaxsizeÚminrr.r/r0r1ZENOTSOCKÚ_USE_CP_SENDFILEZENOSPCÚlseekÚSEEK_CUR)r4r5r7r8r9Z blocksizeÚoffsetZsentr$r$r%Ú_fastcopy_sendfilers8         rFc Cs–|j}|j}tt|ƒƒ�j}||ƒ}|s*qtq||krj|d|…�}| |¡Wdƒqr1s^0Yq||ƒqWdƒn1sˆ0YdS)z–readinto()/memoryview() based variant of copyfileobj(). *fsrc* must support readinto() method and both files must be open in binary mode. N)ÚreadintoÚwriteÚ memoryviewÚ bytearray)r4r5ÚlengthZ fsrc_readintoÚ fdst_writeZmvÚnZsmvr$r$r%Ú_copyfileobj_readinto²s*rNcCs0|st}|j}|j}||ƒ}|s"q,||ƒqdS)z=copy data from file-like object fsrc to file-like object fdstN)Ú COPY_BUFSIZEÚreadrH)r4r5rKZ fsrc_readrLZbufr$r$r%rÅsrcCs¢t|tjƒrHttjdƒrHztj | ¡t |¡¡WStyFYdS0ttjdƒrzztj ||¡WStyxYdS0tj  tj  |¡¡tj  tj  |¡¡kS)NÚsamestatFÚsamefile) Ú isinstancer<ÚDirEntryÚhasattrÚpathrQÚstatr-rRÚnormcaseÚabspath©ÚsrcÚdstr$r$r%Ú _samefileÒs   ÿr]cCst|tjƒr| ¡St |¡S©N)rSr<rTrW©Úfnr$r$r%Ú_statäsracCs t|tjƒr| ¡Stj |¡Sr^)rSr<rTÚ is_symlinkrVÚislinkr_r$r$r%Ú_islinkçsrd©Úfollow_symlinksc Cs^t d||¡t||ƒr(td ||¡ƒ‚d}t||gƒD]h\}}z t|ƒ}Wnty^Yq80t  |j ¡rŽt |t j ƒr~|jn|}td|ƒ‚tr8|dkr8|j}q8|sÄt|ƒrÄt  t  |¡|¡�n–t|dƒ��x}�zt|dƒ��ú}t�r4z2t||tjƒ|WWdƒWWdƒSt�y0Yn0n�t�r€z.t||ƒ|WWdƒWWdƒSt�y|Yn0nDt�rÄ|dk�rÄt||t|tƒƒ|WdƒWWdƒSt ||ƒWdƒn1�sä0YWnHt!�y8} z.t j "|¡�s"t#d|›�ƒ| ‚n‚WYd} ~ n d} ~ 00Wdƒn1�sP0Y|S) zÎCopy data from src to dst in the most efficient way possible. If follow_symlinks is not set and src is a symbolic link, a new symlink will be created instead of copying the file it points to. zshutil.copyfilez{!r} and {!r} are the same filerz`%s` is a named pipeÚrbÚwbNzDirectory does not exist: )$r?Úauditr]r ÚformatÚ enumeraterar-rWÚS_ISFIFOÚst_moderSr<rTrVrÚ_WINDOWSr>rdÚsymlinkÚreadlinkÚopenÚ_HAS_FCOPYFILEr:rZ_COPYFILE_DATAr*rBrFrNrArOrÚIsADirectoryErrorÚexistsÚFileNotFoundError) r[r\rfÚ file_sizeÚir`Ústr4r5Úer$r$r%r êsP       $ $".8r cCspt d||¡|sFt|ƒrFtj |¡rFttdƒr@tjtj}}qRdSn t tj }}||ƒ}||t   |j ¡ƒdS)zàCopy mode bits from src to dst. If follow_symlinks is not set, symlinks aren't followed if and only if both `src` and `dst` are symlinks. If `lchmod` isn't available (e.g. Linux) this method does nothing. zshutil.copymodeÚlchmodN)r?rirdr<rVrcrUÚlstatrzraÚchmodrWÚS_IMODErm)r[r\rfZ stat_funcZ chmod_funcrxr$r$r%r *s  r Ú listxattrc CsÈztj||d�}Wn>tyP}z&|jtjtjtjfvr:‚WYd}~dSd}~00|D]l}z&tj|||d�}tj||||d�WqVtyÀ}z(|jtj tjtjtjfvr¬‚WYd}~qVd}~00qVdS)z®Copy extended filesystem attributes from `src` to `dst`. Overwrite existing attributes. If `follow_symlinks` is false, symlinks won't be followed. reN) r<r~r-r1r3ZENODATAr2ÚgetxattrÚsetxattrZEPERM)r[r\rfÚnamesryr.Úvaluer$r$r%Ú _copyxattr@s ÿrƒcOsdSr^r$)ÚargsÚkwargsr$r$r%rƒXsc s`t d||¡dddœdd„‰|p6t|ƒo4tj |¡ }|rJ‡fdd„}n ‡fdd„}t|tjƒrp|j|d �}n|d ƒ||d �}t  |j ¡}|d ƒ||j |j f|d�t |||d �z|d ƒ|||d �WntyÜYn0t|d ƒ�r\z|dƒ||j|d �WnXt�yZ}z>dD]*}tt|ƒ�r|jtt|ƒk�r�qF�q‚WYd}~n d}~00dS)aÛCopy file metadata Copy the permission bits, last access time, last modification time, and flags from `src` to `dst`. On Linux, copystat() also copies the "extended attributes" where possible. The file contents, owner, and group are unaffected. `src` and `dst` are path-like objects or path names given as strings. If the optional flag `follow_symlinks` is not set, symlinks aren't followed if and only if both `src` and `dst` are symlinks. zshutil.copystatN)ÚnsrfcWsdSr^r$)r†rfr„r$r$r%Ú_nopiszcopystat.._nopcs tt|ˆƒSr^)Úgetattrr<©r.©r‡r$r%Úlookuppszcopystat..lookupcstt|ˆƒ}|tjvr|SˆSr^)rˆr<Úsupports_follow_symlinks)r.r`rŠr$r%r‹us  rerWÚutimer|Úst_flagsZchflags)Z EOPNOTSUPPr3)r?rirdr<rVrcrSrTrWr}rmÚ st_atime_nsÚ st_mtime_nsrƒÚNotImplementedErrorrUrŽr-r1rˆ) r[r\rfZfollowr‹rxÚmodeÚwhyr9r$rŠr%r [s4    ÿ   r cCsBtj |¡r"tj |tj |¡¡}t|||d�t|||d�|S)a3Copy data and mode bits ("cp src dst"). Return the file's destination. The destination may be a directory. If follow_symlinks is false, symlinks won't be followed. This resembles GNU's "cp -P src dst". If source and destination are the same file, a SameFileError will be raised. re)r<rVÚisdirÚjoinÚbasenamer r ©r[r\rfr$r$r%r �s r cCsBtj |¡r"tj |tj |¡¡}t|||d�t|||d�|S)a0Copy data and metadata. Return the file's destination. Metadata is copied with copystat(). Please see the copystat function for more information. The destination may be a directory. If follow_symlinks is false, symlinks won't be followed. This resembles GNU's "cp -P src dst". re)r<rVr”r•r–r r r—r$r$r%r ¯s r cs‡fdd„}|S)z�Function that can be used as copytree() ignore parameter. Patterns is a sequence of glob-style patterns that are used to exclude filescs(g}ˆD]}| t ||¡¡qt|ƒSr^)ÚextendÚfnmatchÚfilterÚset)rVr�Ú ignored_namesÚpattern©Úpatternsr$r%Ú_ignore_patternsÅsz)ignore_patterns.._ignore_patternsr$)rŸr r$ržr%rÀs rc CsD|dur$|t |¡dd„|Dƒƒ}ntƒ}tj||d�g} |tupJ|tu} |D�]‚} | j|vrbqPtj || j¡} tj || j¡} | rŠ| n| }zÖ|   ¡}|rÂtjdkrÂ| j dd�}|j t j krÂd}|�r8t  | ¡}|rôt || ¡t|| | d�nBtj |¡�s |�r WqP|  ¡�r,t|| ||||d�n ||| ƒn*|  ¡�rXt|| ||||d�n ||| ƒWqPt�yš}z|  |jd¡WYd}~qPd}~0t�yÒ}z |  | | t|ƒf¡WYd}~qPd}~00qPzt||ƒWnLt�y0}z2t|d dƒdu�r|  ||t|ƒf¡WYd}~n d}~00| �r@t| ƒ‚|S) NcSsg|] }|j‘qSr$r‰)Ú.0Úxr$r$r%Ú Ïóz_copytree..)Úexist_okrFre)Ú dirs_exist_okrZwinerror)r<Úfspathr›Úmakedirsr r r.rVr•rbrWÚst_reparse_tagÚIO_REPARSE_TAG_MOUNT_POINTrpror rtÚis_dirrrr˜r„r-ÚappendÚstrrˆ)Úentriesr[r\ÚsymlinksÚignoreÚ copy_functionÚignore_dangling_symlinksr¦rœÚerrorsZ use_srcentryZsrcentryZsrcnameZdstnameZsrcobjrbr{Úlinktor9r“r$r$r%Ú _copytreeÌs^         ÿ   ÿ$,*rµc CsXt d||¡t |¡�}t|ƒ}Wdƒn1s60Yt||||||||d�S)a'Recursively copy a directory tree and return the destination directory. If exception(s) occur, an Error is raised with a list of reasons. If the optional symlinks flag is true, symbolic links in the source tree result in symbolic links in the destination tree; if it is false, the contents of the files pointed to by symbolic links are copied. If the file pointed by the symlink doesn't exist, an exception will be added in the list of errors raised in an Error exception at the end of the copy process. You can set the optional ignore_dangling_symlinks flag to true if you want to silence this exception. Notice that this has no effect on platforms that don't support os.symlink. The optional ignore argument is a callable. If given, it is called with the `src` parameter, which is the directory being visited by copytree(), and `names` which is the list of `src` contents, as returned by os.listdir(): callable(src, names) -> ignored_names Since copytree() is called recursively, the callable will be called once for each directory that is copied. It returns a list of names relative to the `src` directory that should not be copied. The optional copy_function argument is a callable that will be used to copy each file. It will be called with the source path and the destination path as arguments. By default, copy2() is used, but any function that supports the same signature (like copy()) can be used. If dirs_exist_ok is false (the default) and `dst` already exists, a `FileExistsError` is raised. If `dirs_exist_ok` is true, the copying operation will continue if it encounters existing directories, and files within the `dst` tree will be overwritten by corresponding files from the `src` tree. zshutil.copytreeN)r®r[r\r¯r°r±r²r¦)r?rir<ÚscandirÚlistrµ) r[r\r¯r°r±r²r¦Zitrr®r$r$r%r s( & ýrÚst_file_attributescCsNz4|jdd�}t |j¡o2|jtj@o0|jtjk WStyHYdS0dS©NFre)rWÚS_ISDIRrmr¸ÚFILE_ATTRIBUTE_REPARSE_POINTr©rªr-)Úentryrxr$r$r%Ú _rmtree_isdirAs    þ r½cCsJz0t |¡}t |j¡p.|jtj@o.|jtjkWSt yDYdS0dS)NF) r<r{rWÚS_ISLNKrmr¸r»r©rªr-)rVrxr$r$r%Ú_rmtree_islinkJs    þ r¿cCs(z|jdd�WSty"YdS0dSr¹)r«r-)r¼r$r$r%r½Ss cCs tj |¡Sr^)r<rVrc)rVr$r$r%r¿Ysc Cs2z6t |¡�}t|ƒ}Wdƒn1s*0YWn(ty^|tj|t ¡ƒg}Yn0|D]’}|j}t|ƒrÂz| ¡rˆtdƒ‚Wn*ty´|tjj |t ¡ƒYqdYn0t ||ƒqdzt  |¡Wqdtyô|tj |t ¡ƒYqd0qdzt  |¡Wn&t�y,|tj |t ¡ƒYn0dS)Nú%Cannot call rmtree on a symbolic link) r<r¶r·r-r?Úexc_inforVr½rbrcÚ_rmtree_unsafeÚunlinkÚrmdir)rVÚonerrorÚ scandir_itr®r¼Úfullnamer$r$r%rÂ]s0 *       rÂc Cs`z6t |¡�}t|ƒ}Wdƒn1s*0YWn>tyt}z&||_|tj|t ¡ƒWYd}~dSd}~00|D�]Þ}tj ||j ¡}z|j dd�}Wnty¶d}YnP0|�rz|j dd�} t   | j ¡}Wn*t�y|tj|t ¡ƒYqzYn0|�rztj|j tj|d�} d} Wn&t�yN|tj|t ¡ƒYnÎ0z¸tj | t | ¡¡�rÀt| ||ƒz"t | ¡d} tj|j |d�Wn&t�y¼|tj|t ¡ƒYn0n6z tdƒ‚Wn(t�yô|tjj|t ¡ƒYn0W| �st | ¡n| �st | ¡0qzztj|j |d�Wqzt�yX|tj|t ¡ƒYqz0qzdS)NFre)Údir_fdTrÀ)r<r¶r·r-r/r?rÁrVr•r.r«rWrºrmr{rqÚO_RDONLYrQr=Ú_rmtree_safe_fdÚcloserÄrcrÃ) ÚtopfdrVrÅrÆr®r9r¼rÇr«Úorig_stÚdirfdZ dirfd_closedr$r$r%rÊ|s^ *         ÿrÊc CsÐt d|¡|rdd„}n|dur*dd„}t�r€t|tƒrDt |¡}zt |¡}Wn&tyx|tj|t  ¡ƒYdS0zt  |tj ¡}d}Wn&ty¶|tj |t  ¡ƒYdS0z²tj   |t |¡¡�r"t|||ƒzt |¡d}t |¡Wn&t�y|tj|t  ¡ƒYn0n6z tdƒ‚Wn(t�yV|tj j|t  ¡ƒYn0W|�s~t |¡n|�s|t |¡0nLzt|ƒ�r”tdƒ‚Wn*t�yÀ|tj j|t  ¡ƒYdS0t||ƒSdS) aÄRecursively delete a directory tree. If ignore_errors is set, errors are ignored; otherwise, if onerror is set, it is called to handle the error with arguments (func, path, exc_info) where func is platform and implementation dependent; path is the argument to that function that caused it to fail; and exc_info is a tuple returned by sys.exc_info(). If ignore_errors is false and onerror is None, an exception is raised. z shutil.rmtreecWsdSr^r$©r„r$r$r%rÅÆszrmtree..onerrorNcWs‚dSr^r$rÏr$r$r%rÅÉsFTrÀ)r?riÚ_use_fd_functionsrSÚbytesr<Úfsdecoder{r,rÁrqrÉrVrQr=rÊrËrÄr-rcr¿rÂ)rVÚ ignore_errorsrÅrÍÚfdZ fd_closedr$r$r%r¹sV          ÿ  rcCs0t |¡}tjjtjjpd}tj | |¡¡S)aHA basename() variant which first strips the trailing slash, if present. Thus we always get the last component of the path, even for directories. path: Union[PathLike, str] e.g. >>> os.path.basename('/bar/foo') 'foo' >>> os.path.basename('/bar/foo/') '' >>> _basename('/bar/foo/') 'foo' Ú)r<r§rVÚsepÚaltsepr–Úrstrip)rVrÖr$r$r%Ú _basenameýs rÙc CsRt d||¡|}tj |¡rbt||ƒr8t ||¡dStj |t|ƒ¡}tj  |¡rbt d|ƒ‚zt ||¡WnÚt �yLtj  |¡r°t  |¡}t ||¡t |¡n˜tj |¡�r4t||ƒrØt d||fƒ‚t|ƒ�s t |tj¡�st |¡�rtjdk�rtd||fƒ‚t|||dd�t|ƒn|||ƒt |¡Yn0|S) a+Recursively move a file or directory to another location. This is similar to the Unix "mv" command. Return the file or directory's destination. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination already exists but is not a directory, it may be overwritten depending on os.rename() semantics. If the destination is on our current filesystem, then rename() is used. Otherwise, src is copied to the destination and then removed. Symlinks are recreated under the new name if os.rename() fails because of cross filesystem renames. The optional `copy_function` argument is a callable that will be used to copy the source or it will be delegated to `copytree`. By default, copy2() is used, but any function that supports the same signature (like copy()) can be used. A lot more could be done here... A look at a mv.c shows a lot of the issues this implementation glosses over. z shutil.moveNz$Destination path '%s' already existsz.Cannot move a directory '%s' into itself '%s'.ÚdarwinzKCannot move the non-empty directory '%s': Lacking write permission to '%s'.T)r±r¯)r?rir<rVr”r]Úrenamer•rÙrtrr-rcrprorÃÚ _destinsrcÚ _is_immutableÚaccessÚW_OKÚlistdirÚplatformÚPermissionErrorrr)r[r\r±Zreal_dstr´r$r$r%rsL          ÿ  ÿÿþþÿ  rcCsVtj |¡}tj |¡}| tjj¡s2|tjj7}| tjj¡sL|tjj7}| |¡Sr^)r<rVrYÚendswithrÖÚ startswithrZr$r$r%rÜQs    rÜcCs(t|ƒ}tjtjg}t|dƒo&|j|vS)NrŽ)rarWÚ UF_IMMUTABLEÚ SF_IMMUTABLErUrŽ)r[rxZimmutable_statesr$r$r%rÝZs rÝcCsLtdus|durdSz t|ƒ}Wnty6d}Yn0|durH|dSdS)z"Returns a gid, given a group name.Né)rÚKeyError©r.Úresultr$r$r%Ú_get_gid_s   rëcCsLtdus|durdSz t|ƒ}Wnty6d}Yn0|durH|dSdS)z"Returns an uid, given a user name.Nrç)rrèrér$r$r%Ú_get_uidks   rìÚgzipcs(|durd}nDtr |dkr d}n2tr2|dkr2d}n trD|dkrDd}ntd |¡ƒ‚d dl} |rfd |nd} |d | } tj | ¡} | r´tj  | ¡s´|dur¦|  d | ¡|s´t  | ¡|durÆ|  d ¡t ˆƒ‰t ˆƒ‰‡‡‡‡fdd„} |�s$|  | d|¡}z|j|| d�W| ¡n | ¡0| S)aúCreate a (possibly compressed) tar file from all the files under 'base_dir'. 'compress' must be "gzip" (the default), "bzip2", "xz", or None. 'owner' and 'group' can be used to define an owner and a group for the archive that is being built. If not provided, the current owner and group will be used. The output tar file will be named 'base_name' + ".tar", possibly plus the appropriate compression extension (".gz", ".bz2", or ".xz"). Returns the output filename. NrÕríZgzÚbzip2Úbz2ÚxzzCbad value for 'compress', or compression format not supported : {0}rÚ.ú.tarú creating %szCreating tar archivecs,ˆdurˆ|_ˆ|_ˆdur(ˆ|_ˆ|_|Sr^)ÚgidZgnameÚuidÚuname)Ztarinfo©rôÚgroupÚownerrõr$r%Ú _set_uid_gid¦sz#_make_tarball.._set_uid_gidzw|%s©rš)Ú_ZLIB_SUPPORTEDÚ_BZ2_SUPPORTEDÚ_LZMA_SUPPORTEDÚ ValueErrorrjÚtarfiler<rVÚdirnamertÚinfor¨rìrërqÚaddrË)Ú base_nameÚbase_dirÚcompressÚverboseÚdry_runrùrøÚloggerZtar_compressionrZ compress_extZ archive_nameÚ archive_dirrúÚtarr$r÷r%Ú _make_tarballws>   ÿ      r c Cs„ddl}|d}tj |¡}|rNtj |¡sN|dur@| d|¡|sNt |¡|durd| d||¡|�s€|j|d|jd��ò}tj  |¡} | tj kr´|  | | ¡|dur´| d| ¡t  |¡D] \} } } t | ƒD]:} tj  tj | | ¡¡} |  | | ¡|durÐ| d| ¡qÐ| D]L} tj  tj | | ¡¡} tj | ¡�r|  | | ¡|du�r| d| ¡�qq¾Wdƒn1�sv0Y|S) z¦Create a zip file from all the files under 'base_dir'. The output zip file will be named 'base_name' + ".zip". Returns the name of the output zip file. rNú.zipróz#creating '%s' and adding '%s' to itÚw)Z compressionz adding '%s')Úzipfiler<rVrrtrr¨ÚZipFileZ ZIP_DEFLATEDÚnormpathÚcurdirrHÚwalkÚsortedr•Úisfile)rrrrr rZ zip_filenamer ZzfrVÚdirpathZdirnamesÚ filenamesr.r$r$r%Ú _make_zipfile¸sF   ÿÿ        2rr )rNzuncompressed tar file)rrízgzip'ed tar-fileZgztarzZIP fileÚzip)rrîzbzip2'ed tar-fileZbztar)rrðzxz'ed tar-fileZxztarcCsdd„t ¡Dƒ}| ¡|S)z‘Returns a list of supported formats for archiving and unarchiving. Each element of the returned sequence is a tuple (name, description) cSsg|]\}}||df‘qS)rçr$)r¡r.Úregistryr$r$r%r£úr¤z'get_archive_formats..)Ú_ARCHIVE_FORMATSÚitemsÚsort©Zformatsr$r$r%rõs ÿrrÕcCst|dur g}t|ƒs td|ƒ‚t|ttfƒs6tdƒ‚|D]&}t|ttfƒrXt|ƒdkr:tdƒ‚q:|||ft|<dS)auRegisters an archive format. name is the name of the format. function is the callable that will be used to create archives. If provided, extra_args is a sequence of (name, value) tuples that will be passed as arguments to the callable. description can be provided to describe the format, and will be returned by the get_archive_formats() function. NzThe %s object is not callablez!extra_args needs to be a sequencerçz+extra_args elements are : (arg_name, value))ÚcallableÚ TypeErrorrSÚtupler·Úlenr)r.ÚfunctionÚ extra_argsÚ descriptionZelementr$r$r%rÿs   rcCs t|=dSr^)rr‰r$r$r%rsrc  CsBt d||||¡t ¡} |durP|dur6| d|¡tj |¡}|sPt |¡|dur^tj}||dœ} z t |} Wn t y”t d|ƒd‚Yn0| d} | dD]\} }|| | <q¦|dkrÐ|| d <|| d <z@| ||fi| ¤Ž}W|du�r>|du�r| d | ¡t | ¡n,|du�r<|du�r2| d | ¡t | ¡0|S) aCreate an archive file (eg. zip or tar). 'base_name' is the name of the file to create, minus any format-specific extension; 'format' is the archive format: one of "zip", "tar", "gztar", "bztar", or "xztar". Or any other registered format. 'root_dir' is a directory that will be the root directory of the archive; ie. we typically chdir into 'root_dir' before creating the archive. 'base_dir' is the directory where we start archiving from; ie. 'base_dir' will be the common prefix of all files and directories in the archive. 'root_dir' and 'base_dir' both default to the current directory. Returns the name of the archive file. 'owner' and 'group' are used when creating a tar archive. By default, uses the current owner and group. zshutil.make_archiveNzchanging into '%s')rr zunknown archive format '%s'rérrùrøzchanging back to '%s') r?rir<ÚgetcwdÚdebugrVrYÚchdirrrrèrÿ)rrjZroot_dirrrrrùrør Zsave_cwdr…Ú format_infoÚfuncÚargÚvalr/r$r$r%rs@           ý    rcCsdd„t ¡Dƒ}| ¡|S)z‘Returns a list of supported formats for unpacking. Each element of the returned sequence is a tuple (name, extensions, description) cSs"g|]\}}||d|df‘qS)rér$)r¡r.rr$r$r%r£Ur¤z&get_unpack_formats..)Ú_UNPACK_FORMATSrrrr$r$r%rOs ÿrc Csji}t ¡D]\}}|dD] }|||<qq |D]$}||vr0d}t||||fƒ‚q0t|ƒsftdƒ‚dS)z+Checks what gets registered as an unpacker.rz!%s is already registered for "%s"z*The registered function must be a callableN)r/rr)rr ) Ú extensionsr#r$Zexisting_extensionsr.rÚextÚ extensionÚmsgr$r$r%Ú_check_unpack_optionsZs  ÿ r4cCs,|dur g}t|||ƒ||||ft|<dS)aMRegisters an unpack format. `name` is the name of the format. `extensions` is a list of extensions corresponding to the format. `function` is the callable that will be used to unpack archives. The callable will receive archives to unpack. If it's unable to handle an archive, it needs to raise a ReadError exception. If provided, `extra_args` is a sequence of (name, value) tuples that will be passed as arguments to the callable. description can be provided to describe the format, and will be returned by the get_unpack_formats() function. N)r4r/)r.r0r#r$r%r$r$r%rls rcCs t|=dS)z*Removes the pack format from the registry.N)r/r‰r$r$r%r‚srcCs&tj |¡}tj |¡s"t |¡dS)z1Ensure that the parent directory of `path` existsN)r<rVrr”r¨)rVrr$r$r%Ú_ensure_directory†s  r5c Csþddl}| |¡std|ƒ‚| |¡}zÆ| ¡D]°}|j}| d¡s2d|vrPq2tjj |g|  d¡¢RŽ}|spq2t |ƒ|  d¡s2|  |d¡�D}t |dƒ�}t||ƒWdƒn1sº0YWdƒq21sØ0Yq2W| ¡n | ¡0dS)z+Unpack zip `filename` to `extract_dir` rNz%s is not a zip fileú/z..Úrrh)rZ is_zipfiler(rZinfolistr/rär<rVr•Úsplitr5rãrqrrË) r/Ú extract_dirrrrr.Z targetpathÚsourceÚtargetr$r$r%Ú_unpack_zipfileŒs(     ÿJr<rûcCsbddl}z| |¡}Wn |jy6td|ƒ‚Yn0z|j||d�W| ¡n | ¡0dS)zAUnpack tar/tar.gz/tar.bz2/tar.xz `filename` to `extract_dir` rNz/%s is not a compressed or uncompressed tar filerû)rrqZTarErrorr(Z extractallrË)r/r9ršrZtarobjr$r$r%Ú_unpack_tarfileªsÿ r=ròr )r rz.tar.gzz.tgzz.tar.bz2z.tbz2z.tar.xzz.txzcCs:t ¡D],\}}|dD]}| |¡r|SqqdS)Nr)r/rrã)r/r.rr2r$r$r%Ú_find_unpack_formatÉs   r>cCsþt d|||¡|dur t ¡}t |¡}t |¡}|durBi}nd|i}|durªz t|}Wn"ty€td |¡ƒd‚Yn0|d}|||fit |dƒ¤|¤ŽnPt |ƒ}|durÈt d |¡ƒ‚t|d}t t|dƒ|B}|||fi|¤ŽdS)a]Unpack an archive. `filename` is the name of the archive. `extract_dir` is the name of the target directory, where the archive is unpacked. If not provided, the current working directory is used. `format` is the archive format: one of "zip", "tar", "gztar", "bztar", or "xztar". Or any other registered format. If not provided, unpack_archive will use the filename extension and see if an unpacker was registered for that extension. In case none is found, a ValueError is raised. If `filter` is given, it is passed to the underlying extraction function. zshutil.unpack_archiveNršzUnknown unpack format '{0}'r&rçzUnknown archive format '{0}') r?rir<r'r§r/rèrÿrjÚdictr>r()r/r9rjršZ filter_kwargsr*r+r…r$r$r%rÐs*      rÚstatvfsÚ disk_usageZusageztotal used freezTotal space in byteszUsed space in byteszFree space in bytescCs@t |¡}|j|j}|j|j}|j|j|j}t|||ƒS)zÖReturn disk usage statistics about the given path. Returned value is a named tuple with attributes 'total', 'used' and 'free', which are the amount of total, used and free space, in bytes. )r<r@Úf_bavailÚf_frsizeÚf_blocksÚf_bfreeÚ_ntuple_diskusage)rVrxÚfreeÚtotalÚusedr$r$r%rA s    cCs"t |¡\}}||}t|||ƒS)z×Return disk usage statistics about the given path. Returned values is a named tuple with attributes 'total', 'used' and 'free', which are the amount of total, used and free space, in bytes. )rZ _getdiskusagerF)rVrHrGrIr$r$r%rAscCs®t d|||¡|dur(|dur(tdƒ‚|}|}|dur>d}n(t|tƒrft|ƒ}|durftd |¡ƒ‚|durtd}n(t|tƒsœt |ƒ}|durœtd |¡ƒ‚t   |||¡dS)z¹Change owner user and group of the given path. user and group can be the uid/gid or the user/group names, and in that case, they are converted to their respective uid/gid. z shutil.chownNzuser and/or group must be setéÿÿÿÿzno such user: {!r}zno such group: {!r}) r?rirÿrSr­rìÚ LookupErrorrjÚintrër<r)rVÚuserrøZ_userZ_groupr$r$r%r%s$  r©éPéc CsÎzttjdƒ}Wnttfy,d}Yn0zttjdƒ}WnttfyZd}Yn0|dksl|dkrÀzt tj ¡¡}Wn"t tt fy¢t  |¡}Yn0|dkr²|j }|dkrÀ|j }t  ||f¡S)aGet the size of the terminal window. For each of the two dimensions, the environment variable, COLUMNS and LINES respectively, is checked. If the variable is defined and the value is a positive integer, it is used. When COLUMNS or LINES is not defined, which is the common case, the terminal connected to sys.__stdout__ is queried by invoking os.get_terminal_size. If the terminal size cannot be successfully queried, either because the system doesn't support querying, or because we are not connected to a terminal, the value given in fallback parameter is used. Fallback defaults to (80, 24) which is the default size used by many terminal emulators. The value returned is a named tuple of type os.terminal_size. ZCOLUMNSrZLINES)rLr<Úenvironrèrÿrr?Ú __stdout__r+ÚAttributeErrorr-Ú terminal_sizeÚcolumnsÚlines)ZfallbackrUrVÚsizer$r$r%rEs$  rcCs&tj |¡o$t ||¡o$tj |¡ Sr^)r<rVrtrÞr”)r`r’r$r$r%Ú _access_checkvs ÿrXc sÀtj ˆ¡rtˆ|ƒrˆSdStˆtƒ}|durrtj dd¡}|durrzt d¡}Wnt t fyptj }Yn0|szdS|rœt  |¡}|  t  tj¡¡}nt |¡}|  tj¡}tjdk�rRtj}|rÒt  |¡}||vræ| d|¡t d¡pòt}dd„|  tj¡Dƒ}|�rd d„|Dƒ}t‡fd d „|Dƒƒ�r>ˆg}n‡fd d„|Dƒ}nˆg}tƒ}|D]X} tj | ¡} | |v�rb| | ¡|D],} tj | | ¡} t| |ƒ�rŠ| S�qŠ�qbdS) a3Given a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. NÚPATHÚCS_PATHZwin32rZPATHEXTcSsg|] }|r|‘qSr$r$©r¡r1r$r$r%r£¯r¤zwhich..cSsg|]}t |¡‘qSr$)r<Úfsencoder[r$r$r%r£²r¤c3s |]}ˆ ¡ | ¡¡VqdSr^)Úlowerrãr[©Úcmdr$r%Ú ·r¤zwhich..csg|] }ˆ|‘qSr$r$r[r^r$r%r£ºr¤)r<rVrrXrSrÑrQÚgetÚconfstrrSrÿÚdefpathr\r8ÚpathseprÒr?rárÚinsertÚgetenvÚ_WIN_DEFAULT_PATHEXTÚanyr›rXrr•) r_r’rVZ use_bytesrZpathext_sourceZpathextÚfilesÚseenÚdirZnormdirZthefiler.r$r^r%r{sV              r)r)F)FN)rírrNNN)rrN)NrÕ)NNrrNNN)NrÕ)NN)NN)rN)jr'r<r?rWr™Ú collectionsr1ÚzlibrüÚ ImportErrorrïrýZlzmarþÚpwdrZgrprr.rnrrrOrUrárärBrrrgÚ__all__r-rr rrr(r,r)r*r:rFrNrr]rardr r rƒr r r rrµrÚ stat_resultr½r¿rÂrÊrqrÃrÄÚsupports_dir_fdr¶Ú supports_fdrŒrÐrZavoids_symlink_attacksrÙrrÜrÝrërìr rrrrrrrr4rrr5r<r=r/r>rr¬Ú namedtuplerFrHrIrGrArrrXÚF_OKÚX_OKrr$r$r$r%Ús>             @  @ B ÿ Aÿ 0 8ÿ þ ý B B   ÿ A - ÿÿÿÿ ÿ 8 ÿ   þ ÿ ÿ ÿ1       1