{FndZddlmZddlZddlmZmZ ddlZn #e$rdZYnwxYwddl m Z ddl m Z ddl mZdd lmZ dd lmZn #e$rdZYnwxYw dd lmZn #e$rdZYnwxYwd Zd Z d3d4dZ d5d6dZedgd fed!gd"fed#gd$fed%gd&fed'gd(fegd)fd*Zd+Ze d7d8d/Ze d9d:d1Z d7d;d2ZdS)._set_uid_gidms. ?GK!GM ?GK!GMzw|)filter)keys ValueErrorgetrospathdirnametarfilerinforropenaddclose)rrrr r"r#r%tar_compression compress_ext archive_namer>r5tarr0r2s `` @@r make_tarballrG;sr0 O "F%@@L 0A0A0C0C C C K   v%LL$$Xr222L 27??< ( ('::::NNNH #$$$ 5//C 5//C ll<)Ioh.G)I)IJJ  GGH\G 2 2 2 IIKKKKCIIKKKK s %DD'c (|dz}ttj||t@|rd}nd} t d|||g|n8#t $rt d|dwxYwtjd |||s t j |d tj }n1#t$r$t j |d tj }YnwxYw|5|tj krhtjtj|d }|||tjd |tj|D]\}} } | D]k} tjtj|| d }|||tjd |l| D]} tjtj|| }tj|r+|||tjd | dddn #1swxYwY|S)avCreate a zip file from all the files under 'base_dir'. The output zip file will be named 'base_name' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if installed and found on the default search path). If neither tool is available, raises DistutilsExecError. Returns the name of the output zip file. z.zipr-Nz-rz-rqzipzunable to create zip file 'zN': could neither import the 'zipfile' module nor find a standalone zip utilityz#creating '%s' and adding '%s' to itw) compressionr+z adding '%s')rr;r<r=zipfiler r rr?ZipFile ZIP_DEFLATED RuntimeError ZIP_STOREDcurdirnormpathjoinwritewalkisfile) rrr r" zip_filename zipoptionsrIr<dirpathdirnames filenamesrs r make_zipfiler\sv%L 27??< ( ('::::  JJJ  5*lH=w O O O O O!   %0l000   6 hOOO : Yo #73G  Y Y YolCWEWXXX Y : :ry((7++BGLL2,F,FGGDIIdD)))H]D11146GH4E4E : :0GXy (66!w// WdB0O0OPP $---5555 )::!w// Wd0K0KLL7>>$//:IIdD111H]D999 : :  : : : : : : : : : : : : : : : s1AA8!B77+C%$C%*FJJ J )rrzgzip'ed tar-file)rr,zbzip2'ed tar-file)rr*zxz'ed tar-file)rrzcompressed tar file)rNzuncompressed tar filezZIP file)gztarbztarxztarztarrFrIc*|D]}|tvr|cSdS)zqReturns the first format from the 'format' list that is unknown. If all formats are known, returns None N)ARCHIVE_FORMATS)formatsformats rcheck_archive_formatsres1   ( (MMM ) 4r6rdroot_dir:str | os.PathLike[str] | bytes | os.PathLike[bytes] | NonecdSr/rrdrfrr r"r#r%s r make_archiverk  #r63str | os.PathLike[str] | bytes | os.PathLike[bytes]cdSr/rirjs rrkrkrlr6c~tj}|Jtjd|tj|}|stj|| tj}d|i} t|} n!#t$rtd|dwxYw| d} | | d|dkr || d <|| d < | ||fi| } |)tjd |tj|n1#|*tjd |tj|wwxYw| 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", "xztar", or "ztar". '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. Nzchanging into '%s'r"zunknown archive format ''rrrIr#r%zchanging back to '%s') r;getcwdrdebugr<abspathchdirrQrbrr9update) rrdrfrr r"r#r%save_cwdkwargs format_infofuncfilenames rrkrksr4y{{H &111GOOI..   HX   9 !F?%f- ???=F===>>>? q>D MM+a.!!! ww4 866v66   I-x 8 8 8 HX      I-x 8 8 8 HX      Os3 BB D .D:)rFFNN)rrrrrrr r!r"r!r#r$r%r$r&r)FF) rrrrr r!r"r!r&r)NNFFNN)rrrdrrfrgrr$r r!r"r!r#r$r%r$r&r)NFFNN)rrrdrrfrmrr$r r!r"r!r#r$r%r$r&r)rrrdrrfrgrr$r r!r"r!r#r$r%r$r&r)__doc__ __future__rr;typingrrrL ImportError_logrdir_utilrerrorsr r pwdr grpr rrrGr\rbrerkrir6rrs #""""" $$$$$$$$NNNNGGG&&&&&&HHHHHH       7=BBBBBP ?????F124F G235H I/02B C 457L M -.0G H "j )  LP              LP9999999s0%%AAAAA'&A'