AlkantarClanX12

Your IP : 3.149.235.66


Current Path : /opt/alt/python39/lib64/python3.9/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/distutils/__pycache__/archive_util.cpython-39.pyc

a

R�f|!�@s>dZddlZddlmZddlZzddlZWneyBdZYn0ddlmZddl	m
Z
ddlmZddl
mZzddlmZWney�dZYn0zdd	lmZWney�dZYn0d
d�Zdd
�Zd#dd�Zd$dd�Zedgdfedgdfedgdfedgdfedgdfegdfd�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)�getgrnamcCsLtdus|durdSzt|�}Wnty6d}Yn0|durH|dSdS)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_gids
rcCsLtdus|durdSzt|�}Wnty6d}Yn0|durH|dSdS)z"Returns an uid, given a user name.Nr	)rr
rrrr�_get_uid+s
r�gzipcs6dddddd�}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�bzip2rN�compressz.gzz.bz2z.xzz.Z)rrrrNzKbad value for 'compress': must be None, 'gzip', 'bzip2', 'xz' or 'compress'z.tarr��dry_runrzCreating tar archivecs,�dur�|_�|_�dur(�|_�|_|S)N)�gidZgname�uid�uname)Ztarinfo�r�group�ownerrrr�_set_uid_gidasz"make_tarball.<locals>._set_uid_gidzw|%s)�filterz'compress' will be deprecated.Zwin32z-f)�keys�
ValueError�getr�os�path�dirname�tarfiler�inforr�open�add�closer�PendingDeprecationWarning�sys�platformr)�	base_name�base_dirr�verboserrrZtar_compressionZcompress_extZarchive_namer(r �tarZcompressed_name�cmdrrr�make_tarball7sB���
	


r5c
Cs�|d}ttj�|�|d�tdurn|r.d}nd}ztd|||g|d�Wntyhtd|��Yn0�nJt�d||�|�s�ztj	|d	tj
d
�}Wn$ty�tj	|d	tjd
�}Yn0|��|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�qWd�n1�s�0Y|S)
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-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)Zcompressionrzadding '%s')rr%r&r'�zipfilerrrr)ZZipFileZZIP_DEFLATED�RuntimeErrorZ
ZIP_STORED�curdir�normpath�join�write�walk�isfile)r0r1r2rZzip_filenameZ
zipoptionsr6r&�dirpathZdirnames�	filenamesrrrr�make_zipfilesT	�
���
�
4rB)rrzgzip'ed tar-file)rrzbzip2'ed tar-file)rrzxz'ed tar-file)rrzcompressed tar file)rNzuncompressed tar filezZIP file)ZgztarZbztarZxztarZztarr3r6cCs|D]}|tvr|SqdS)zqReturns the first format from the 'format' list that is unknown.

    If all formats are known, returns None
    N)�ARCHIVE_FORMATS)Zformats�formatrrr�check_archive_formats�s
rEc
Cst��}|dur6t�d|�tj�|�}|s6t�|�|durDtj}d|i}	zt|}
Wnt	yvt
d|��Yn0|
d}|
dD]\}}
|
|	|<q�|dkr�||	d<||	d	<z4|||fi|	��}W|dur�t�d
|�t�|�n"|du�rt�d
|�t�|�0|S)a�Create 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.
    Nzchanging into '%s'rzunknown archive format '%s'r�r6rrzchanging back to '%s')r%�getcwdr�debugr&�abspath�chdirr:rCr
r#)r0rDZroot_dirr1r2rrrZsave_cwd�kwargsZformat_info�func�arg�val�filenamerrr�make_archive�s8

�
rP)rrrNN)rr)NNrrNN)�__doc__r%�warningsrr.r8�ImportErrorZdistutils.errorsrZdistutils.spawnrZdistutils.dir_utilrZ	distutilsr�pwdrZgrprrrr5rBrCrErPrrrr�<module>sH


�
H
=




�	
�