Your IP : 3.142.251.204
a
R�f|! � @ s> d Z ddlZddlmZ ddlZzddlZW n eyB dZY n0 ddlmZ ddl m
Z
ddlmZ ddl
mZ zddlmZ W n ey� dZY n0 zdd lmZ W n ey� dZY n0 d
d� Zdd
� Zd#dd�Zd$dd�Zedgdfedgdfedgdfedgdfedgdfeg dfd�Zdd � Zd%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 sL t du s| du rdS zt | �}W n ty6 d}Y n0 |durH|d S dS )z"Returns a gid, given a group name.N� )r �KeyError��name�result� r �;/opt/alt/python39/lib64/python3.9/distutils/archive_util.py�_get_gid s
r c C sL t du s| du rdS zt | �}W n ty6 d}Y n0 |durH|d S dS )z"Returns an uid, given a user name.Nr )r r
r r r r �_get_uid+ s
r �gzipc s6 dddddd�}dddd d
�}|dur:||� � vr:td��| d
} |dkrZ| |�|d�7 } ttj�| �|d� ddl}
t� d� t
���t��� � ���fdd�}|s�|
�| d|| �}z|j
||d� W |�� n
|�� 0 |dk�r2tdt� | || }
tjdk�r|| |
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.
Zgz�bz2�xz� )r �bzip2r N�compressz.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)�gidZgname�uid�uname)Ztarinfo�r �group�ownerr r r �_set_uid_gida s z"make_tarball.<locals>._set_uid_gidzw|%s)�filterz'compress' will be deprecated.Zwin32z-f)�keys�
ValueError�getr �os�path�dirname�tarfiler �infor r �open�add�closer �PendingDeprecationWarning�sys�platformr )� base_name�base_dirr �verboser r r Ztar_compressionZcompress_extZarchive_namer( r �tarZcompressed_name�cmdr r r �make_tarball7 sB ���
r5 c
C s� | d }t tj�|�|d� tdu rn|r.d}nd}ztd|||g|d� W n tyh td| ��Y n0 �nJt�d||� |�s�ztj |d tj
d
�}W n$ ty� tj |d tjd
�}Y n0 |�� |tj
kr�tj�tj�|d��}|�||� t�d|� t�|�D ]�\}} }
| D ]6}tj�tj�||d��}|�||� t�d|� �q|
D ]B}tj�tj�||��}tj�|��rP|�||� t�d|� �qP�qW d � n1 �s�0 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-rq�zipzkunable to create zip file '%s': could neither import the 'zipfile' module nor find a standalone zip utilityz#creating '%s' and adding '%s' to it�w)Zcompressionr zadding '%s')r r% r&