Your IP : 18.220.73.131


Current Path : /lib64/python3.6/distutils/__pycache__/
Upload File :
Current File : //lib64/python3.6/distutils/__pycache__/archive_util.cpython-36.opt-2.pyc

3


 \F!� @s@ddlZddlmZddlZyddlZWnek
r@dZYnXddlmZddlm	Z	ddl
mZddlm
Z
yddlmZWnek
r�dZYnXyddlmZWnek
r�dZYnXd	d
�Zdd�Zd dd�Zd!dd�Zed"gdfed#gdfed$gdfed%gdfed&gdfegdfd�Zdd�Zd'dd�ZdS)(�N)�warn)�DistutilsExecError)�spawn)�mkpath)�log)�getpwnam)�getgrnamcCsNtdks|dkrdSyt|�}Wntk
r8d}YnX|dk	rJ|dSdS)N�)r�KeyError)�name�result�r
�./usr/lib64/python3.6/distutils/archive_util.py�_get_gids
rcCsNtdks|dkrdSyt|�}Wntk
r8d}YnX|dk	rJ|dSdS)Nr	)rr
)rrr
r
r�_get_uid+s
r�gzipcs.dddddd�}dddd	d
�}|dk	r:||j�kr:td��|d}	|d
krZ|	|j|d�7}	ttjj|	�|d�ddl}
tj	d�t
���t�������fdd�}|s�|
j|	d||�}z|j
||d�Wd|j�X|d
k�r*tdt�|	||}
tjdk�r||	|
g}n
|d|	g}t||d�|
S|	S)NZgz�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,�dk	r�|_�|_�dk	r(�|_�|_|S)N)�gidZgname�uid�uname)Ztarinfo)r�group�ownerrr
r�_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�cmdr
)rrrrr�make_tarball7s<
	



r2cCs�|d}ttjj|�|d�tdkrp|r.d}nd}ytd|||g|d�Wn tk
rjtd|��YnX�n:tjd||�|�s�ytj	|dtj
d	�}Wn&tk
r�tj	|dtjd	�}YnX|tj
kr�tjjtjj|d
��}|j||�tjd|�x�tj|�D]�\}}	}
x>|	D]6}tjjtjj||d
��}|j||�tjd|��qWxJ|
D]B}tjjtjj||��}tjj|��rV|j||�tjd|��qVW�qW|j�|S)Nz.zip)rz-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�isfiler))r-r.r/rZzip_filenameZ
zipoptionsr3r#�dirpathZdirnames�	filenamesrr
r
r�make_zipfilesJ	


r?rzgzip'ed tar-filerzbzip2'ed tar-filerzxz'ed tar-filezcompressed tar filezuncompressed tar filezZIP file)ZgztarZbztarZxztarZztarr0r3cCsx|D]}|tkr|SqWdS)N)�ARCHIVE_FORMATS)Zformats�formatr
r
r�check_archive_formats�s
rBcCs�tj�}|dk	r6tjd|�tjj|�}|s6tj|�|dkrDtj}d|i}	yt|}
Wn t	k
rxt
d|��YnX|
d}x|
dD]\}}
|
|	|<q�W|dkr�||	d<||	d<z|||f|	�}Wd|dk	r�tjd	|�tj|�X|S)
Nzchanging into '%s'rzunknown archive format '%s'r�r3rrzchanging back to '%s')r"�getcwdr�debugr#�abspath�chdirr7r@r
r )r-rAZroot_dirr.r/rrrZsave_cwd�kwargsZformat_info�func�arg�val�filenamer
r
r�make_archive�s2
rM)rrrNN)rr)rr)rr)rr)rr)rN)NNrrNN)r"�warningsrr+r5�ImportErrorZdistutils.errorsrZdistutils.spawnrZdistutils.dir_utilrZ	distutilsr�pwdrZgrprrrr2r?r@rBrMr
r
r
r�<module>s@



G
=