/usr/lib/python3.10/distutils/__pycache__
Edit: /usr/lib/python3.10/distutils/__pycache__/archive_util.cpython-310.pyc (6508B)
o
bc|! @ sF d Z ddlZddlmZ ddlZzddlZW n ey! dZY nw ddlmZ ddl m
Z
ddlmZ ddl
mZ zddlmZ W n eyM dZY nw zdd lmZ W n eya dZY nw d
d Zdd
Z d#ddZd$ddZedgdfedgdfedgdfedgdfedgdfeg dfdZdd Z d%d!d"ZdS )&zodistutils.archive_util
Utility functions for creating archive files (tarballs, zip files,
that sort of thing). N)warn)DistutilsExecError)spawn)mkpath)log)getpwnam)getgrnamc C L t du s| du r
dS zt | }W n ty d}Y nw |dur$|d S dS )z"Returns a gid, given a group name.N )r KeyErrornameresult r -/usr/lib/python3.10/distutils/archive_util.py_get_gid r c C r )z"Returns an uid, given a user name.Nr
)r r r r r r _get_uid+ r r gzipc s2 dddddd}dddd d
}|dur|| vrtd| d
} |dkr-| ||d7 } ttj| |d ddl}
t d t
t fdd}|sp|
| d|| }z
|j
||d W | n| w |dkrtdt | || }
tjdkr|| |
g}n|d| g}t||d |
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 s, d ur
| _ | _d ur| _| _| S )N)gidgnameuiduname)tarinfor groupownerr r r _set_uid_gida s z"make_tarball.
._set_uid_gidzw|%s)filterz'compress' will be deprecated.win32z-f)keys
ValueErrorgetr ospathdirnametarfiler infor r openaddcloser PendingDeprecationWarningsysplatformr ) base_namebase_dirr verboser r$ r# tar_compressioncompress_extarchive_namer. r% tarcompressed_namecmdr r" r make_tarball7 sB
r? c
C s | d }t tj||d tdu r4|rd}nd}z
td|||g|d W |S ty3 td| w td|| |sztj |d tj
d
}W n tyZ tj |d tjd
}Y nw |o |tj
krztjtj|d}||| td| t|D ]D\}} }
| D ]}tjtj||d}||| td| q|
D ]}tjtj||}tj|r||| td| qqW d |S 1 sw Y |S )
av Create 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-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)compressionr zadding '%s')r r+ r, r- zipfiler r r r/ ZipFileZIP_DEFLATEDRuntimeError
ZIP_STOREDcurdirnormpathjoinwritewalkisfile)r6 r7 r8 r zip_filename
zipoptionsr@ r, dirpathdirnames filenamesr
r r r make_zipfile sf %
rS )r r zgzip'ed tar-file)r r zbzip2'ed tar-file)r r zxz'ed tar-file)r r zcompressed tar file)r Nzuncompressed tar filezZIP file)gztarbztarxztarztarr<