ef|!HdZddlZddlmZddlZ ddlZn #e$rdZYnwxYwddlmZddl m Z ddl m Z ddl m Z  dd lmZn #e$rdZYnwxYw dd lmZn #e$rdZYnwxYwd Zd Z ddZddZedgdfedgdfedgdfedgdfedgdfegdfdZdZ d dZdS)!zodistutils.archive_util Utility functions for creating archive files (tarballs, zip files, that sort of thing).N)warn)DistutilsExecError)spawn)mkpath)log)getpwnam)getgrnamcvt|dS t|}n#t$rd}YnwxYw||dSdS)z"Returns a gid, given a group name.N)r KeyErrornameresults /builddir/build/BUILD/imunify360-venv-2.3.5/opt/imunify360/venv/lib/python3.11/site-packages/setuptools/_distutils/archive_util.py_get_gidr \4<t$  ay 4  ,,cvt|dS t|}n#t$rd}YnwxYw||dSdS)z"Returns an uid, given a user name.Nr )r r rs r_get_uidr-rrgzipcdddddd}dddd d }|%||vrtd |d z} |dkr| ||dz } ttj| |dd l} tj dttfd} |se| | d||z} | || | n#| wxYw|dkrNtdt | ||z} t"jdkr|| | g}n|d| g}t'||| S| S)a=Create a (possibly compressed) tar file from all the files under 'base_dir'. 'compress' must be "gzip" (the default), "bzip2", "xz", "compress", or None. ("compress" will be deprecated in Python 3.2) '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_dir' + ".tar", possibly plus the appropriate compression extension (".gz", ".bz2", ".xz" or ".Z"). Returns the output filename. gzbz2xz)rbzip2rNcompressz.gzz.bz2z.xzz.Z)rrrrNzKbad value for 'compress': must be None, 'gzip', 'bzip2', 'xz' or 'compress'z.tarrdry_runrzCreating tar archivecH|_|_|_|_|S)N)gidgnameuiduname)tarinfor"groupownerr$s r _set_uid_gidz"make_tarball.._set_uid_gidjs. ?GK!GM ?GK!GMzw|%s)filterz'compress' is deprecated.win32z-f)keys ValueErrorgetrospathdirnametarfilerinforropenaddcloserDeprecationWarningsysplatformr) base_namebase_dirrverboser r(r'tar_compression compress_ext archive_namer3r)tarcompressed_namecmdr"r$s `` @@r make_tarballrD:s& O"F%TRRL 0A0A0C0C C C !   v%L: ((2666  27??< ( ('::::NNNH #$$$ 5//C 5//C ll</(2K)KLL  GGH\G 2 2 2 IIKKKKCIIKKKK: (*<===&h)?? <7 " "\?;CCT<0C c7#### s -DD/c &|dz}ttj||t?|rd}nd} t d|||g|n7#t $rt d|zwxYwtjd|||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.ziprNz-rz-rqzipzkunable to create zip file '%s': could neither import the 'zipfile' module nor find a standalone zip utilityz#creating '%s' and adding '%s' to itw) compressionrz adding '%s')rr0r1r2zipfilerrrr4ZipFile ZIP_DEFLATED RuntimeError ZIP_STOREDcurdirnormpathjoinwritewalkisfile) r;r<r=r zip_filename zipoptionsrFr1dirpathdirnames filenamesrs r make_zipfilerYsv%L 27??< ( ('::::  JJJ  5*lH=w O O O O O!   %4    6 hOOO : Yo #73G  Y Y YolCWEWXXX Y : :ry((7++BGLL2,F,FGGDIIdD)))H]D11146GH4E4E : :0GXy (66!w// WdB0O0OPP $---5555 )::!w// Wd0K0KLL7>>$//:IIdD111H]D999 : :  : : : : : : : : : : : : : : : s1AA7!B66+C$#C$)FJJ  J )rrzgzip'ed tar-file)rrzbzip2'ed tar-file)rrzxz'ed tar-file)rrzcompressed tar file)rNzuncompressed tar filezZIP file)gztarbztarxztarztarrArFc*|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_formatsrbs1   ( (MMM ) 4r*cltj}|Jtjd|tj|}|stj|| tj}d|i} t|} n #t$rtd|zwxYw| d} | dD] \} } | | | < |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 '%s'rrrFr(r'zchanging back to '%s') r0getcwdrdebugr1abspathchdirrNr_r r.)r;raroot_dirr<r=r r(r'save_cwdkwargs format_infofuncargvalfilenames r make_archiverps}4y{{H &111GOOI..   HX   9 !FA%f- AAA6?@@@A q>DNSs  ww4 866v66   I-x 8 8 8 HX      I-x 8 8 8 HX      Os3 BB D.D1)rrrNN)rr)NNrrNN)__doc__r0warningsrr9rI ImportErrorerrorsrrdir_utilr_logrpwdr grpr rrrDrYr_rbrpr*rrzs&   NNNNGGG'&&&&&HHHHHH      SWLLLL^====B124F G235H I/02B C 457L M -.0G H "j )    ::::::s/!!AA AAA#"A#