Your IP : 18.116.88.132


Current Path : /opt/alt/python33/lib/python3.3/site-packages/setuptools/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib/python3.3/site-packages/setuptools/__pycache__/archive_util.cpython-33.pyc

�
�Re�c@s�dZdddddddgZdd	lZdd	lZdd	lZdd	lZdd	lZdd
lmZddl	m
Z
Gdd�de
�Zd
d�Zed	dd�Zedd�Zedd�Zedd�ZeeefZd	S(u/Utilities for extracting common archive formatsuunpack_archiveuunpack_zipfileuunpack_tarfileudefault_filteruUnrecognizedFormatuextraction_driversuunpack_directoryiN(uensure_directory(uDistutilsErrorcBs|EeZdZdZdS(uUnrecognizedFormatu#Couldn't recognize the archive typeN(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u0/tmp/pip-k8wh6o-build/setuptools/archive_util.pyuUnrecognizedFormat
scCs|S(u@The default progress/filter callback; returns True for all files((usrcudst((u0/tmp/pip-k8wh6o-build/setuptools/archive_util.pyudefault_filtersc
Cs[xT|ptD]6}y||||�Wntk
r>w
Yq
XdSq
Wtd|��dS(u�Unpack `filename` to `extract_dir`, or raise ``UnrecognizedFormat``

    `progress_filter` is a function taking two arguments: a source path
    internal to the archive ('/'-separated), and a filesystem path where it
    will be extracted.  The callback must return the desired extract path
    (which may be the same as the one passed in), or else ``None`` to skip
    that file or directory.  The callback can thus be used to report on the
    progress of the extraction, as well as to filter the items extracted or
    alter their extraction paths.

    `drivers`, if supplied, must be a non-empty sequence of functions with the
    same signature as this function (minus the `drivers` argument), that raise
    ``UnrecognizedFormat`` if they do not support extracting the designated
    archive type.  The `drivers` are tried in sequence until one is found that
    does not raise an error, or until all are exhausted (in which case
    ``UnrecognizedFormat`` is raised).  If you do not supply a sequence of
    drivers, the module's ``extraction_drivers`` constant will be used, which
    means that ``unpack_zipfile`` and ``unpack_tarfile`` will be tried, in that
    order.
    Nu!Not a recognized archive type: %s(uextraction_driversuUnrecognizedFormat(ufilenameuextract_diruprogress_filterudriversudriver((u0/tmp/pip-k8wh6o-build/setuptools/archive_util.pyuunpack_archive*s
c
CsGtjj|�s(td|f��nid|f|6}xtj|�D]�\}}}||\}}xD|D]<}	||	dtjj||	�f|tjj||	�<qqWx�|D]�}
||
}tjj||
�}|||
|�}|s�q�nt|�tjj||
�}
tj|
|�tj	|
|�q�WqKWdS(u�"Unpack" a directory, using the same interface as for archives

    Raises ``UnrecognizedFormat`` if `filename` is not a directory
    u%s is not a directoryuu/N(
uosupathuisdiruUnrecognizedFormatuwalkujoinuensure_directoryushutilucopyfileucopystat(
ufilenameuextract_diruprogress_filterupathsubaseudirsufilesusrcudstudufunameutarget((u0/tmp/pip-k8wh6o-build/setuptools/archive_util.pyuunpack_directorySs"
:


c
Cs\tj|�s%td|f��ntj|�}zx|j�D]}|j}|jd�sDd|jd�kr}qDntj	j
||jd��}|||�}|s�qDn|jd�r�t|�nMt|�|j
|j�}t|d�}z|j|�Wd|j�~X|jd?}	|	rDtj||	�qDqDWWd|j�XdS(u�Unpack zip `filename` to `extract_dir`

    Raises ``UnrecognizedFormat`` if `filename` is not a zipfile (as determined
    by ``zipfile.is_zipfile()``).  See ``unpack_archive()`` for an explanation
    of the `progress_filter` argument.
    u%s is not a zip fileu/u..uwbNi(uzipfileu
is_zipfileuUnrecognizedFormatuZipFileuinfolistufilenameu
startswithusplituosupathujoinuendswithuensure_directoryureaduopenuwriteucloseu
external_attruchmod(
ufilenameuextract_diruprogress_filteruzuinfounameutargetudataufuunix_attributes((u0/tmp/pip-k8wh6o-build/setuptools/archive_util.pyuunpack_zipfile|s2	$



c	Cs�ytj|�}Wn(tjk
r=td|f��YnXz�dd�|_xl|D]d}|j}|jd�rWd|jd�krWtj	j
||jd��}x||dk	r'|j�s�|j
�r'|j}|j
�rtj
tj|j�|�}tj|�}n|j|�}q�W|dk	r�|j�sL|j�r�|||�}|r�|jtj�r�|dd�}ny|j||�Wq�tjk
r�Yq�Xq�q�qWqWWd	SWd|j�XdS(
u�Unpack tar/tar.gz/tar.bz2 `filename` to `extract_dir`

    Raises ``UnrecognizedFormat`` if `filename` is not a tarfile (as determined
    by ``tarfile.open()``).  See ``unpack_archive()`` for an explanation
    of the `progress_filter` argument.
    u/%s is not a compressed or uncompressed tar filecWsdS(N(uNone(uargs((u0/tmp/pip-k8wh6o-build/setuptools/archive_util.pyu<lambda>�su unpack_tarfile.<locals>.<lambda>u/u..Nii����T(utarfileuopenuTarErroruUnrecognizedFormatuchownunameu
startswithusplituosupathujoinuNoneuislnkuissymulinknameu	posixpathudirnameunormpathu
_getmemberuisfileuisdiruendswithusepu_extract_memberuExtractErroruTrueuclose(	ufilenameuextract_diruprogress_filterutarobjumemberunameu
prelim_dstulinkpathu	final_dst((u0/tmp/pip-k8wh6o-build/setuptools/archive_util.pyuunpack_tarfile�s8
	%'	$(u__doc__u__all__uzipfileutarfileuosushutilu	posixpathu
pkg_resourcesuensure_directoryudistutils.errorsuDistutilsErroruUnrecognizedFormatudefault_filteruNoneuunpack_archiveuunpack_directoryuunpack_zipfileuunpack_tarfileuextraction_drivers(((u0/tmp/pip-k8wh6o-build/setuptools/archive_util.pyu<module>s<(),*

?>