1j$! d Z ddlmZ ddlZddlmZmZ ddlZn
# e$ r dZY nw xY wddl m
Z
ddlmZ ddl
mZ dd lmZ dd
lmZ n
# e$ r dZY nw xY w ddlmZ n
# e$ r dZY nw xY wd Zd
Z d2d3dZ d4d5dZedgdfed gd!fed"gd#fed$gd%fed&gd'feg d(fd)Zd* Ze d6d7d. Ze d8d9d0 Z d6d:d1ZdS );zodistutils.archive_util
Utility functions for creating archive files (tarballs, zip files,
that sort of thing). )annotationsN)Literaloverload )log)mkpath)DistutilsExecError)spawn)getpwnam)getgrnamc v t | dS t | }n# t $ r d}Y nw xY w||d S dS )z"Returns a gid, given a group name.N )r KeyErrornameresults Y/opt/cloudlinux/venv/lib64/python3.11/site-packages/setuptools/_distutils/archive_util.py_get_gidr ! \ 4<t$
ay4 ,,c v t | dS t | }n# t $ r d}Y nw xY w||d S dS )z"Returns an uid, given a user name.Nr )r r r s r _get_uidr . r r gzipF base_namestrbase_dirstr | os.PathLike[str]compress%Literal['gzip', 'bzip2', 'xz'] | Noneverboseboolowner
str | Nonegroupreturnc P
ddddd}dddd }|%|| vrt d | dz }|| |d z
}t t j | d
d
l} t j d t
t
fd}
| |d|| } |
||
| n# | w xY w|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_dir' + ".tar", possibly plus
the appropriate compression extension (".gz", ".bz2", ".xz" or ".Z").
Returns the output filename.
gzbz2xz )r bzip2r) Nz.gzz.bz2z.xz)r r+ r) Nz=bad value for 'compress': must be None, 'gzip', 'bzip2', 'xz'z.tarr zCreating tar archivec H | _ | _ | _ | _ | S N)gidgnameuiduname)tarinfor. r$ r" r0 s r _set_uid_gidz"make_tarball.