Sindbad~EG File Manager
�
��abc@s"dZddlZddlZddlZddlmZddlZddlZddlZddl m
Z
yddlZeZ
Wnek
r�eZ
nXyddlmZWnek
r�dZnXyddlmZWnek
r�dZnXdd d
ddd
dddddddddddddddgZdefd��YZdefd��YZdefd��YZd efd!��YZd"efd#��YZyeWnek
r�dZnXdWd&�Zd'�Z d(�Z!d)�Z"d*�Z#d+�Z$d,�Z%d-�Z&ede%ed.�Z'edd/�Z(d0�Z)d1�Z*d2�Z+d3�Z,d4�Z-d5d6d6dddd7�Z.eed8�Z/d6d6dd9�Z0ie.dXgd;fd<6e.dYgd>fd?6e.dZgd@fdA6e0gdBfdC6Z1e
re.d[gd>fe1d?<ndD�Z2ddEdF�Z3dG�Z4ddd6d6ddddH�Z5dI�Z6dJ�Z7ddEdK�Z8dL�Z9dM�Z:dN�Z;dO�Z<idPdQge<gd;fd<6dRge<gd@fdA6dSge;gdBfdC6Z=e
rdTge<gd>fe=d?<ndU�Z>dddV�Z?dS(\s�Utility functions for copying and archiving files and directory trees.
XXX The functions here don't copy the resource fork or other metadata on Mac.
i����N(tabspathi(ttarfile(tgetpwnam(tgetgrnamtcopyfileobjtcopyfiletcopymodetcopystattcopytcopy2tcopytreetmovetrmtreetErrortSpecialFileErrort ExecErrortmake_archivetget_archive_formatstregister_archive_formattunregister_archive_formattget_unpack_formatstregister_unpack_formattunregister_unpack_formattunpack_archivetignore_patternscBseZRS((t__name__t
__module__(((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR
,scBseZdZRS(s|Raised when trying to do a kind of operation (e.g. copying) which is
not supported on a special file (e.g. a named pipe)(RRt__doc__(((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR/scBseZdZRS(s+Raised when a command could not be executed(RRR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR3st ReadErrorcBseZdZRS(s%Raised when an archive cannot be read(RRR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR6st
RegistryErrorcBseZdZRS(sVRaised when a registry operation with the archiving
and unpacking registries fails(RRR(((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR9siicCs1x*|j|�}|sPn|j|�qWdS(s=copy data from file-like object fsrc to file-like object fdstN(treadtwrite(tfsrctfdsttlengthtbuf((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRCs
cCs{ttjd�rAytjj||�SWqAtk
r=tSXntjjtjj|��tjjtjj|��kS(Ntsamefile(thasattrtostpathR$tOSErrortFalsetnormcaseR(tsrctdst((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt _samefileKs
cCs�t||�r(td||f��nx`||gD]R}ytj|�}Wntk
raq5Xtj|j�r5td|��q5q5Wt|d��,}t|d��}t ||�WdQXWdQXdS(sCopy data from src to dsts`%s` and `%s` are the same files`%s` is a named pipetrbtwbN(
R-R
R&tstatR(tS_ISFIFOtst_modeRtopenR(R+R,tfntstR R!((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRWs
cCsGttd�rCtj|�}tj|j�}tj||�ndS(sCopy mode bits from src to dsttchmodN(R%R&R0tS_IMODER2R6(R+R,R5tmode((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRkscCs�tj|�}tj|j�}ttd�rOtj||j|jf�nttd�rqtj||�nttd�r�t|d�r�ytj ||j
�Wq�tk
r�}ttd�s�|jtj
kr��q�q�XndS(sCCopy all stat info (mode bits, atime, mtime, flags) from src to dsttutimeR6tchflagstst_flagst
EOPNOTSUPPN(R&R0R7R2R%R9tst_atimetst_mtimeR6R:R;R(terrnoR<(R+R,R5R8twhy((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRrscCsTtjj|�r6tjj|tjj|��}nt||�t||�dS(sVCopy data and mode bits ("cp src dst").
The destination may be a directory.
N(R&R'tisdirtjointbasenameRR(R+R,((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR�s$
cCsTtjj|�r6tjj|tjj|��}nt||�t||�dS(s]Copy data and all stat info ("cp -p src dst").
The destination may be a directory.
N(R&R'RARBRCRR(R+R,((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR �s$
cs�fd�}|S(s�Function that can be used as copytree() ignore parameter.
Patterns is a sequence of glob-style patterns
that are used to exclude filescs:g}x'�D]}|jtj||��q
Wt|�S(N(textendtfnmatchtfiltertset(R'tnamest
ignored_namestpattern(tpatterns(sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt_ignore_patterns�s
((RKRL((RKsH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR�scCs
tj|�}|dk r-|||�}n t�}tj|�g}xG|D]?} | |krhqPntjj|| �}
tjj|| �}y�tjj|
�r�tj|
�}|r�tj ||�q6tjj
|�r�|r�wPn||
|�n8tjj|
�r)t|
||||�n
||
|�WqPt
k
r`}
|j|
jd�qPtk
r�}|j|
|t|�f�qPXqPWyt||�WnMtk
r�}tdk r�t|t�r�q�|j||t|�f�nX|r t
|��ndS(s�Recursively copy a directory tree.
The destination directory must not already exist.
If exception(s) occur, an Error is raised with a list of reasons.
If the optional symlinks flag is true, symbolic links in the
source tree result in symbolic links in the destination tree; if
it is false, the contents of the files pointed to by symbolic
links are copied. If the file pointed by the symlink doesn't
exist, an exception will be added in the list of errors raised in
an Error exception at the end of the copy process.
You can set the optional ignore_dangling_symlinks flag to true if you
want to silence this exception. Notice that this has no effect on
platforms that don't support os.symlink.
The optional ignore argument is a callable. If given, it
is called with the `src` parameter, which is the directory
being visited by copytree(), and `names` which is the list of
`src` contents, as returned by os.listdir():
callable(src, names) -> ignored_names
Since copytree() is called recursively, the callable will be
called once for each directory that is copied. It returns a
list of names relative to the `src` directory that should
not be copied.
The optional copy_function argument is a callable that will be used
to copy each file. It will be called with the source path and the
destination path as arguments. By default, copy2() is used, but any
function that supports the same signature (like copy()) can be used.
iN(R&tlistdirtNoneRGtmakedirsR'RBtislinktreadlinktsymlinktexistsRAR
R
RDtargstEnvironmentErrortappendtstrRR(tWindowsErrort
isinstance(R+R,tsymlinkstignoret
copy_functiontignore_dangling_symlinksRHRIterrorstnametsrcnametdstnametlinktoterrR@((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR
�sD$
$ cCs�|rd�}n|dkr*d�}ny%tjj|�rNtd��nWn.tk
r|tjj|tj��dSXg}ytj|�}Wn-tjk
r�|tj|tj��nXx�|D]�}tjj ||�}ytj
|�j}Wntjk
rd}nXtj
|�r@t|||�q�ytj|�Wq�tjk
r�|tj|tj��q�Xq�Wytj|�Wn-tjk
r�|tj|tj��nXdS(s�Recursively delete a directory tree.
If ignore_errors is set, errors are ignored; otherwise, if onerror
is set, it is called to handle the error with arguments (func,
path, exc_info) where func is os.listdir, os.remove, or os.rmdir;
path is the argument to that function that caused it to fail; and
exc_info is a tuple returned by sys.exc_info(). If ignore_errors
is false and onerror is None, an exception is raised.
cWsdS(N((RT((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pytonerrorscWs�dS(N((RT((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRdss%Cannot call rmtree on a symbolic linkNi(RNR&R'RPR(tsystexc_infoRMterrorRBtlstatR2R0tS_ISDIRRtremovetrmdir(R't
ignore_errorsRdRHR_tfullnameR8((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR�s>
!cCstjj|jtjj��S(N(R&R'RCtrstriptsep(R'((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt _basename'scCs|}tjj|�r~t||�r;tj||�dStjj|t|��}tjj|�r~td|��q~nytj||�Wn�t k
rtjj|�r�t
||�r�td||f��nt||dt�t
|�qt||�tj|�nXdS(s�Recursively move a file or directory to another location. This is
similar to the Unix "mv" command.
If the destination is a directory or a symlink to a directory, the source
is moved inside the directory. The destination path must not already
exist.
If the destination already exists but is not a directory, it may be
overwritten depending on os.rename() semantics.
If the destination is on our current filesystem, then rename() is used.
Otherwise, src is copied to the destination and then removed.
A lot more could be done here... A look at a mv.c shows a lot of
the issues this implementation glosses over.
Ns$Destination path '%s' already existss.Cannot move a directory '%s' into itself '%s'.RZ(R&R'RAR-trenameRBRpRSR
R(t
_destinsrcR
tTrueRR tunlink(R+R,treal_dst((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR,s$
cCsut|�}t|�}|jtjj�s@|tjj7}n|jtjj�sh|tjj7}n|j|�S(N(RtendswithR&R'Rot
startswith(R+R,((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRrTscCs^tdks|dkrdSyt|�}Wntk
rEd}nX|dk rZ|dSdS(s"Returns a gid, given a group name.iN(RRNtKeyError(R_tresult((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt_get_gid]s
cCs^tdks|dkrdSyt|�}Wntk
rEd}nX|dk rZ|dSdS(s"Returns an uid, given a user name.iN(RRNRx(R_Ry((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt_get_uidis
tgzipics|idd6dd6}idd6} tr>d|d<d| d<n|dk rn|| krntdj|���n|d | j|d�}
tjj|
�}tjj|�s�|dk r�|j d
|�n|s�tj
|�q�n|dk r|j d�nt���t�������fd�}|sxt
j|
d
||�}
z|
j|d|�Wd|
j�Xn|
S(s�Create a (possibly compressed) tar file from all the files under
'base_dir'.
'compress' must be "gzip" (the default), "bzip2", or None.
'owner' and 'group' can be used to define an owner and a group for the
archive that is being built. If not provided, the current owner and group
will be used.
The output tar file will be named 'base_name' + ".tar", possibly plus
the appropriate compression extension (".gz", or ".bz2").
Returns the output filename.
tgzR|ts.gztbz2tbzip2s.bz2sCbad value for 'compress', or compression format not supported : {0}s.tarscreating %ssCreating tar archivecsF�dk r!�|_�|_n�dk rB�|_�|_n|S(N(RNtgidtgnametuidtuname(ttarinfo(R�tgrouptownerR�(sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt_set_uid_gid�s sw|%sRFN(RNt_BZ2_SUPPORTEDt
ValueErrortformattgetR&R'tdirnameRStinfoROR{RzRR3taddtclose(t base_nametbase_dirtcompresstverbosetdry_runR�R�tloggerttar_compressiontcompress_exttarchive_nametarchive_dirR�ttar((R�R�R�R�sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt
_make_tarballus4
cCs}|rd}nd}ddlm}ddlm}y |d|||gd|�Wn!|k
rxtd�|�nXdS( Ns-rs-rqi����(tDistutilsExecError(tspawntzipR�skunable to create zip file '%s': could neither import the 'zipfile' module nor find a standalone zip utility(tdistutils.errorsR�tdistutils.spawnR�R(R�tzip_filenameR�R�t
zipoptionsR�R�((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt_call_external_zip�s
cCs�|d}tjj|�}tjj|�sf|dk rM|jd|�n|sftj|�qfnyddl}Wntk
r�d}nX|dkr�t ||||�n�|dk r�|jd||�n|s�|j
|dd|j�}x�tj|�D]�\} }
}xs|D]k}tjj
tjj| |��}
tjj|
�r|j|
|
�|dk r�|jd|
�q�qqWqW|j�n|S( smCreate a zip file from all the files under 'base_dir'.
The output zip file will be named 'base_name' + ".zip". Uses either the
"zipfile" Python module (if available) or the InfoZIP "zip" utility
(if installed and found on the default search path). If neither tool is
available, raises ExecError. Returns the name of the output zip
file.
s.zipscreating %si����Ns#creating '%s' and adding '%s' to ittwtcompressionsadding '%s'(R&R'R�RSRNR�ROtzipfiletImportErrorR�tZipFiletZIP_DEFLATEDtwalktnormpathRBtisfileRR�(R�R�R�R�R�R�R�R�R�tdirpathtdirnamest filenamesR_R'((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt
_make_zipfile�s8
!
R�sgzip'ed tar-filetgztarR�sbzip2'ed tar-filetbztarsuncompressed tar fileR�sZIP fileR�cCs=gtj�D]\}}||df^q
}|j�|S(s�Returns a list of supported formats for archiving and unarchiving.
Each element of the returned sequence is a tuple (name, description)
i(t_ARCHIVE_FORMATStitemstsort(R_tregistrytformats((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR�s,
R~cCs�|dkrg}nt|tj�s:td|��nt|ttf�s^td��nxE|D]=}t|ttf�s�t|�dkretd��qeqeW|||ft|<dS(suRegisters an archive format.
name is the name of the format. function is the callable that will be
used to create archives. If provided, extra_args is a sequence of
(name, value) tuples that will be passed as arguments to the callable.
description can be provided to describe the format, and will be returned
by the get_archive_formats() function.
sThe %s object is not callables!extra_args needs to be a sequenceis+extra_args elements are : (arg_name, value)N( RNRYtcollectionstCallablet TypeErrorttupletlisttlenR�(R_tfunctiont
extra_argstdescriptiontelement((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRs
(cCst|=dS(N(R�(R_((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRsc Csktj�} |d
k rb|d
k r7|jd|�ntjj|�}|sbtj|�qbn|d
krztj}ni|d6|d6}
yt|}Wn!t k
r�t
d|��nX|d}x"|dD]\}
}||
|
<q�W|dkr||
d<||
d <nz||||
�}Wd
|d
k rf|d
k rV|jd| �ntj| �nX|S(s�Create an archive file (eg. zip or tar).
'base_name' is the name of the file to create, minus any format-specific
extension; 'format' is the archive format: one of "zip", "tar", "bztar"
or "gztar".
'root_dir' is a directory that will be the root directory of the
archive; ie. we typically chdir into 'root_dir' before creating the
archive. 'base_dir' is the directory where we start archiving from;
ie. 'base_dir' will be the common prefix of all files and
directories in the archive. 'root_dir' and 'base_dir' both default
to the current directory. Returns the name of the archive file.
'owner' and 'group' are used when creating a tar archive. By default,
uses the current owner and group.
schanging into '%s'R�R�sunknown archive format '%s'iiR�R�R�Nschanging back to '%s'(R&tgetcwdRNtdebugR'RtchdirtcurdirR�RxR�(R�R�troot_dirR�R�R�R�R�R�tsave_cwdtkwargstformat_infotfunctargtvaltfilename((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR s6
cCsDgtj�D]#\}}||d|df^q
}|j�|S(s�Returns a list of supported formats for unpacking.
Each element of the returned sequence is a tuple
(name, extensions, description)
ii(t_UNPACK_FORMATSR�R�(R_R�R�((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRWs3
c Cs�i}x9tj�D]+\}}x|dD]}|||<q*WqWx=|D]5}||krId}t||||f��qIqIWt|tj�s�td��ndS(s+Checks what gets registered as an unpacker.is!%s is already registered for "%s"s*The registered function must be a callableN(R�R�RRYR�R�R�( t
extensionsR�R�texisting_extensionsR_R�textt extensiontmsg((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt_check_unpack_optionsbs
cCs?|dkrg}nt|||�||||ft|<dS(sMRegisters an unpack format.
`name` is the name of the format. `extensions` is a list of extensions
corresponding to the format.
`function` is the callable that will be
used to unpack archives. The callable will receive archives to unpack.
If it's unable to handle an archive, it needs to raise a ReadError
exception.
If provided, `extra_args` is a sequence of
(name, value) tuples that will be passed as arguments to the callable.
description can be provided to describe the format, and will be returned
by the get_unpack_formats() function.
N(RNR�R�(R_R�R�R�R�((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyRts cCst|=dS(s*Removes the pack format from the registry.N(R�(R_((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR�scCs8tjj|�}tjj|�s4tj|�ndS(s1Ensure that the parent directory of `path` existsN(R&R'R�RARO(R'R�((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt_ensure_directory�sc CsAyddl}Wntk
r/td��nX|j|�sRtd|��n|j|�}z�x�|j�D]�}|j}|jd�sqd|kr�qqntj j
||jd��}|s�qqnt|�|j
d�sq|j|j�}t|d�}z|j|�Wd|j�~XqqqqWWd|j�XdS(s+Unpack zip `filename` to `extract_dir`
i����Ns/zlib not supported, cannot unpack this archive.s%s is not a zip filet/s..R/(R�R�Rt
is_zipfileR�tinfolistR�RwR&R'RBtsplitR�RvRR3RR�( R�textract_dirR�R�R�R_ttargettdatatf((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt_unpack_zipfile�s0
cCs]ytj|�}Wn$tjk
r9td|��nXz|j|�Wd|j�XdS(s:Unpack tar/tar.gz/tar.bz2 `filename` to `extract_dir`
s/%s is not a compressed or uncompressed tar fileN(RR3tTarErrorRt
extractallR�(R�R�ttarobj((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt_unpack_tarfile�ss.tar.gzs.tgzs.tars.zips.bz2cCsIxBtj�D]4\}}x%|dD]}|j|�r$|Sq$Wq
WdS(Ni(R�R�RvRN(R�R_R�R�((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt_find_unpack_format�s
cCs�|dkrtj�}n|dk r�yt|}Wn&tk
r]tdj|���nX|d}|||t|d��nbt|�}|dkr�t dj|���nt|d}tt|d�}||||�dS(s�Unpack an archive.
`filename` is the name of the archive.
`extract_dir` is the name of the target directory, where the archive
is unpacked. If not provided, the current working directory is used.
`format` is the archive format: one of "zip", "tar", or "gztar". Or any
other registered format. If not provided, unpack_archive will use the
filename extension and see if an unpacker was registered for that
extension.
In case none is found, a ValueError is raised.
sUnknown unpack format '{0}'iisUnknown archive format '{0}'N(
RNR&R�R�RxR�R�tdictR�R(R�R�R�R�R�R�((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyR�s
i@(R�R|(R�R�(R�N(R�R�(@RR&ReR0tos.pathRRER�R?R~RRRsR�R�R)tpwdRRNtgrpRt__all__RUR
RRRt ExceptionRRXt NameErrorRR-RRRRR RR
RRpRRrRzR{R�R�R�R�RRRRRR�RRR�R�R�R�R�R(((sH/usr/lib/python2.7/site-packages/pip/_vendor/distlib/_backport/shutil.pyt<module>
s�
Q1 ( =/
6 %
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists