l.?4b B d Z ddlZddlmZ ddlZ ddlZn
# e$ r dZY nw xY wddlmZ ddl m
Z
ddlmZ ddl
mZ ddlmZ n
# e$ r dZY nw xY w dd lmZ n
# e$ r dZY nw xY wd
Zd Z dd
ZddZedgdfedgdfedgdfedgdfedgdfeg dfdZd Z ddZdS ) zodistutils.archive_util
Utility functions for creating archive files (tarballs, zip files,
that sort of thing). N)warn)DistutilsExecError)spawn)mkpath)log)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 C/opt/alt/python-internal/lib64/python3.11/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 gzipc dddddd}dddd d
}|%|| vrt d | d
z } |dk r| | |d z
} t t j | | ddl}
t j d t t fd}|se|
| d|| z } |
|| | n# | w xY w|dk rNt dt | || z }
t" j dk r|| |
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 )r bzip2r Ncompressz.gzz.bz2z.xzz.Z)r r r r NzKbad value for 'compress': must be None, 'gzip', 'bzip2', 'xz' or 'compress'z.tarr dry_runr zCreating tar archivec H | _ | _ | _ | _ | S )N)gidgnameuiduname)tarinfor! groupownerr# s r _set_uid_gidz"make_tarball.