a �DOg|!�@s:ddlZddlmZddlZz ddlZWney>dZYn0ddlmZddlm Z ddl m Z ddl m Z zddlmZWney�dZYn0zddlmZWney�dZYn0d d �Zd d �Zd"dd�Zd#dd�Zedgdfedgdfedgdfedgdfedgdfegdfd�Zdd�Zd$d d!�ZdS)%�N)�warn)�DistutilsExecError)�spawn)�mkpath)�log)�getpwnam)�getgrnamcCsLtdus|durdSz t|�}Wnty6d}Yn0|durH|dSdS�N�)r�KeyError��name�result�r�./usr/lib64/python3.9/distutils/archive_util.py�_get_gids   rcCsLtdus|durdSz t|�}Wnty6d}Yn0|durH|dSdSr )rr r rrr�_get_uid+s   r�gzipcs6dddddd�}dddd d �}|dur:||��vr:td ��|d } |d krZ| |�|d�7} ttj�| �|d�ddl} t� d�t ���t �������fdd�} |s�| � | d||�} z| j || d�W| ��n | ��0|d k�r2tdt�| ||} tjdk�r|| | g}n |d| g}t||d�| S| S)N�gz�bz2�xz�)r�bzip2rN�compressz.gzz.bz2z.xzz.Z)rrrrzKbad value for 'compress': must be None, 'gzip', 'bzip2', 'xz' or 'compress'z.tarr��dry_runrzCreating tar archivecs,�dur�|_�|_�dur(�|_�|_|S�N)�gid�gname�uid�uname)�tarinfo�r�group�ownerrrr� _set_uid_gidasz"make_tarball.._set_uid_gidzw|%s)�filterz'compress' will be deprecated.�win32z-f)�keys� ValueError�getr�os�path�dirname�tarfiler�inforr�open�add�closer�PendingDeprecationWarning�sys�platformr)� base_name�base_dirr�verboserr$r#�tar_compression� compress_ext� archive_namer.r%�tarZcompressed_name�cmdrr"r� make_tarball7sB���         r>c Cs�|d}ttj�|�|d�tdurn|r.d}nd}ztd|||g|d�Wntyhtd|��Yn0�nJt�d||�|�s�ztj |dtj d �}Wn$t y�tj |dtj 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) Nz.ziprz-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)� compressionrz adding '%s')rr+r,r-�zipfilerrrr/�ZipFile� ZIP_DEFLATED� RuntimeErrorZ ZIP_STORED�curdir�normpath�join�write�walk�isfile) r6r7r8r� zip_filenameZ zipoptionsr?r,�dirpath�dirnames� filenamesr rrr� make_zipfilesT  �  ���  �      4rP)rrzgzip'ed tar-file)rrzbzip2'ed tar-file)rrzxz'ed tar-file)rrzcompressed tar file)rNzuncompressed tar filezZIP file)�gztar�bztar�xztarZztarr<r?cCs|D]}|tvr|SqdSr)�ARCHIVE_FORMATS)�formats�formatrrr�check_archive_formats�s rWc 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) Nzchanging into '%s'rzunknown archive format '%s'r�r?r$r#zchanging back to '%s') r+�getcwdr�debugr,�abspath�chdirrFrTr r))r6rV�root_dirr7r8rr$r#�save_cwd�kwargs� format_info�func�arg�val�filenamerrr� make_archive�s8        �   re)rrrNN)rr)NNrrNN)r+�warningsrr4rB� ImportErrorZdistutils.errorsrZdistutils.spawnrZdistutils.dir_utilrZ distutilsr�pwdr�grprrrr>rPrTrWrerrrr�sF              � H =     �  �