Your IP : 3.141.201.92


Current Path : /opt/alt/python35/lib64/python3.5/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python35/lib64/python3.5/distutils/__pycache__/archive_util.cpython-35.opt-2.pyc



���]��&@s�ddlZddlmZddlZyddlZWnek
rRdZYnXddlmZddlm	Z	ddl
mZddlm
Z
yddlmZWnek
r�dZYnXyddlmZWnek
r�dZYnXd	d
�Zdd�Zd
dddddd�Zdddd�Zded%gdfded&gdfded'gdfded(gdfded)gdfdegd fiZd!d"�Zddddddd#d$�ZdS)*�N)�warn)�DistutilsExecError)�spawn)�mkpath)�log)�getpwnam)�getgrnamcCs_tdks|dkrdSyt|�}Wntk
rFd}YnX|dk	r[|dSdS)N�)r�KeyError)�name�result�r
�1/opt/alt/python35/lib64/python3.5/archive_util.py�_get_gids
rcCs_tdks|dkrdSyt|�}Wntk
rFd}YnX|dk	r[|dSdS)Nr	)rr
)rrr
r
r�_get_uid+s
r�gzipcs�ddddddddddi}dddd	dd
ddi}|dk	rl||j�krltd��|d
}	|dkr�|	|j|d�7}	ttjj|	�d|�ddl}
tj	d�t
���t�������fdd�}|sE|
j|	d||�}z|j
|d|�Wd|j�X|dkr�tdt�|	||}
tjdkr�||	|
g}n|d|	g}t|d|�|
S|	S)Nr�gz�bzip2�bz2�xz��compressz.gzz.bz2z.xzz.ZzKbad value for 'compress': must be None, 'gzip', 'bzip2', 'xz' or 'compress'z.tar�dry_runrzCreating tar archivecs@�dk	r�|_�|_�dk	r<�|_�|_|S)N)�gid�gname�uid�uname)�tarinfo)r�group�ownerrr
r�_set_uid_gidas				z"make_tarball.<locals>._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�verboserrr�tar_compression�compress_ext�archive_namer)r �tarZcompressed_name�cmdr
)rrrrr�make_tarball7s<	

	
r9cCs�|d}ttjj|�d|�tdkr�|rAd}nd}y td|||gd|�Wq�tk
r�td|��Yq�Xn�tjd||�|s�ytj	|dd	tj
�}Wn-tk
r�tj	|dd	tj�}YnXx�tj
|�D]t\}}}	xb|	D]Z}
tjjtjj||
��}tjj|�r|j||�tjd
|�qWqW|j�|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�compressionzadding '%s')rr&r'r(�zipfilerrrr*�ZipFile�ZIP_DEFLATED�RuntimeErrorZ
ZIP_STORED�walk�normpath�join�isfile�writer-)r1r2r3r�zip_filenameZ
zipoptionsr:�dirpath�dirnames�	filenamesrr'r
r
r�make_zipfiles:	
	
	


!
rJ�gztarrzgzip'ed tar-file�bztarrzbzip2'ed tar-file�xztarrzxz'ed tar-fileZztarzcompressed tar filer7zuncompressed tar filer:zZIP filecCs%x|D]}|tkr|SqWdS)N)�ARCHIVE_FORMATS)�formats�formatr
r
r�check_archive_formats�s
rQcCs7tj�}|dk	rMtjd|�tjj|�}|sMtj|�|dkrbtj}d|i}	yt|}
Wn"t	k
r�t
d|��YnX|
d}x"|
dD]\}}
|
|	|<q�W|dkr�||	d<||	d<z||||	�}Wd|dk	r2tjd	|�tj|�X|S)
Nzchanging into '%s'rzunknown archive format '%s'r�r:rrzchanging back to '%s')r&�getcwdr�debugr'�abspath�chdir�curdirrNr
r$)r1rP�root_dirr2r3rrr�save_cwd�kwargs�format_info�func�arg�val�filenamer
r
r�make_archive�s2
	



r`)rr)rr)rr)rr)rN)r&�warningsrr/r=�ImportErrorZdistutils.errorsrZdistutils.spawnrZdistutils.dir_utilrZ	distutilsr�pwdr�grprrrr9rJrNrQr`r
r
r
r�<module>s@


	G5
	

?>