Spade

Mini Shell

Directory:~$ /proc/self/root/lib/python2.7/site-packages/setuptools/
Upload File

[Home] [System Details] [Kill Me]
Current File:~$ //proc/self/root/lib/python2.7/site-packages/setuptools/archive_util.pyc

�
b-�Qc@s�dZdddddddgZdd	lZdd	lZdd	lZdd	lZdd	lZdd
lmZddl	m
Z
de
fd��YZd
�Zed	d�Zed�Zed�Zed�ZeeefZd	S(s/Utilities
for extracting common archive
formatstunpack_archivetunpack_zipfiletunpack_tarfiletdefault_filtertUnrecognizedFormattextraction_driverstunpack_directoryi����N(tensure_directory(tDistutilsErrorcBseZdZRS(s#Couldn't
recognize the archive type(t__name__t
__module__t__doc__(((s;/usr/lib/python2.7/site-packages/setuptools/archive_util.pyR
scCs|S(s@The
default progress/filter callback; returns True for all
files((tsrctdst((s;/usr/lib/python2.7/site-packages/setuptools/archive_util.pyRscCsZxS|ptD]5}y||||�Wntk
r=q
q
XdSq
Wtd|��dS(s�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.
    Ns!Not a recognized archive type:
%s(RR(tfilenametextract_dirtprogress_filtertdriverstdriver((s;/usr/lib/python2.7/site-packages/setuptools/archive_util.pyR*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(s�"Unpack" a directory, using the same
interface as for archives

    Raises ``UnrecognizedFormat`` if `filename` is not a directory
    s%s is not a directorytt/N(
tostpathtisdirRtwalktjoinRtshutiltcopyfiletcopystat(
RRRtpathstbasetdirstfilesRR
tdtftnamettarget((s;/usr/lib/python2.7/site-packages/setuptools/archive_util.pyRSs"
:


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(s�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.
    s%s is not a zip fileRs..twbNi(tzipfilet
is_zipfileRtZipFiletinfolistRt
startswithtsplitRRRtendswithRtreadtopentwritetcloset
external_attrtchmod(
RRRtztinfoR#R$tdataR"tunix_attributes((s;/usr/lib/python2.7/site-packages/setuptools/archive_util.pyR|s2	$



c	Cs�ytj|�}Wn'tjk
r<td|f��nXz|d�|_xe|D]]}|j}|jd�rSd|jd�krStj	j
||jd��}x||dk	r#|j�s�|j
�r#|j}|j
�rtj
tj|j�|�}tj|�}n|j|�}q�W|dk	r�|j�sH|j�r�|||�}|r�|jtj�r||d
}ny|j||�Wq�tjk
r�q�Xq�q�qSqSWtSWd|j�XdS(s�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.
    s/%s is not a compressed or uncompressed tar
filecWsdS(N(tNone(targs((s;/usr/lib/python2.7/site-packages/setuptools/archive_util.pyt<lambda>�sRs..i����N(ttarfileR.tTarErrorRtchownR#R*R+RRRR7tislnktissymtlinknamet	posixpathtdirnametnormpatht
_getmembertisfileRR,tsept_extract_membertExtractErrortTrueR0(	RRRttarobjtmemberR#t
prelim_dsttlinkpatht	final_dst((s;/usr/lib/python2.7/site-packages/setuptools/archive_util.pyR�s8
	%'	$
(Rt__all__R&R:RRR@t
pkg_resourcesRtdistutils.errorsRRRR7RRRRR(((s;/usr/lib/python2.7/site-packages/setuptools/archive_util.pyt<module>s<	(),*