VULN_CHECK_I913V6 SSh|!@dZddlZddlmZddlZ ddlZddlmZddl m Z ddl m Z ddl m Z  dd lmZ dd lmZd Zd Z dd ZddZedgdfedgdfedgdfedgdfedgdfegdfdZdZ ddZy#e$rdZYlwxYw#e$rdZYZwxYw#e$rdZY`wxYw) zodistutils.archive_util Utility functions for creating archive files (tarballs, zip files, that sort of thing).N)warn)DistutilsExecError)spawn)mkpath)log)getpwnam)getgrnamc^t|y t|}||dSy#t$rd}YwxYw)z"Returns a gid, given a group name.N)r KeyErrornameresults G/usr/lib/python3.12/site-packages/setuptools/_distutils/archive_util.py_get_gidr H4<$ay    ,,c^t|y t|}||dSy#t$rd}YwxYw)z"Returns an uid, given a user name.Nr )r r rs r_get_uidr-rrcdddddd}dddd d }|||jvr td |d z} |dk7r| |j|dz } ttj j | |dd l} tjdttfd} |s<| j| d||z} | j|| | j|dk(rEtdt | ||z} t"j$dk(r|| | g}n|d| g}t'||| S| S#| jwxYw)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)gzipbzip2rNcompressz.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:si& O"F%TRL 0A0A0C C !  v%L: ((266  277??< (':HH #$ 5/C 5/C ll</(2K)KL  GGH\G 2 IIK: (*<=&h)?? <<7 "\?;CT<0C c7#  IIKs D==Ec "|dz}ttjj||t|rd}nd} t d|||g||Stjd|||s t j|d tj }|5|tjk7retjjtjj|d }|j!||tjd |tj"|D]\}} } | D]h} tjjtjj|| d }|j!||tjd |j| D]} tjjtjj|| }tjj%|s`|j!||tjd | ddd|S|S#t $rt d|zwxYw#t$r*t j|d tj }YwxYw#1swY|SxYw) 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 277??< (': JJ  5*lH=w OP 5 6 hO Yoo #73G3G ryy(77++BGGLL2,FGDIIdD)HH]D146GGH4E0GXy (!ww// WdB0OP $-5!)!*!ww// Wd0KL77>>$/IIdD1HH]D9 !* 5F  <O" %4   (  YoolCWEWEWX Y s0H3,&IE$J9-J3I /JJJ)rrzgzip'ed tar-file)rrzbzip2'ed tar-file)rrzxz'ed tar-file)rrzcompressed tar file)rNzuncompressed tar filezZIP file)gztarbztarxztarztarrArFc*|D]}|tvs |cSy)zqReturns the first format from the 'format' list that is unknown. If all formats are known, returns None N)ARCHIVE_FORMATS)formatsformats rcheck_archive_formatsrbs   (M r*cbtj}|Ltjd|tjj |}|stj ||tj}d|i} t|} | d} | dD] \} } | | | < |dk7r || d<|| d< | ||fi| }|+tjd |tj ||S#t$rtd|zwxYw#|,tjd |tj |wwxYw) 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. zchanging 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_archiverps84yy{H &1GGOOI.  HHX 99 !FA%f-  q>DNSs #ww 86v6   II-x 8 HHX  O% A6?@@A   II-x 8 HHX  s: C#* C>#C;>0D.)rrrNN)rr)NNrrNN)__doc__r0warningsrr9rI ImportErrorerrorsrrdir_utilr_logrpwdr grpr rrrDrYr_rbrpr*rrzs    '  SWL^=B124F G235H I/02B C 457L M -.0G H "j )    :eGH Hs3A9BB9BBBBBB