Your IP : 216.73.216.236
�
��f�c/@s�dZddlZddlZddlZddlmZddlZddlZddlZddl Z yddl
Z
[
dyZWne
k
r�dzZYnXyddlmZWne
k
r�dZYnXyddlmZWne
k
r�dZYnXdddd d
ddd
dddddddddddddddgZGdd�de�ZGdd�de�ZGdd�de�ZGd d!�d!e�ZGd"d#�d#e�ZyeWnek
r�dZYnXd{d&d�Zd'd(�Zd)dyd*d�Z d)dyd+d�Z!e"ed,�r;d)dyd-d.�Z#nd/d.�Z#d)dyd0d �Z$d)dyd1d
�Z%d)dyd2d�Z&d3d�Z'dzde&dzd4d�Z(d5d6�Z)d7d8�Z*ej+ejej,ej-hej.koej/ej0koejej1kZ2dzdd9d�Z3e2e3_4d:d;�Z5d<d
�Z6d=d>�Z7d?d@�Z8dAdB�Z9dCddddddDdE�Z:dzdzdFdG�Z;ddddHdI�Z<ie:d|gdKfdL6e:d}gdMfdN6e<gdOfdP6Z=er�e:d~gdRfe=dS<ndTd�Z>ddUdVd�Z?dWd�Z@ddddddddXd�ZAdYd�ZBdZd[�ZCddUd\d�ZDd]d�ZEd^d_�ZFd`da�ZGdbdc�ZHidddegeHgdKfdL6dfgeHgdMfdN6dggeGgdOfdP6ZIer
dhgeHgdRfeIdS<ndidj�ZJdddkd�ZKe"edl�rhejLdm�ejMdndo�ZNdpdm�ZOnIejPdqkr�ddlQZQejLdm�ejMdndo�ZNdrdm�ZOndddsd�ZRddvdw�ZSejTejUBddxd�ZVdS(�u�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.
iN(uabspath(ugetpwnam(ugetgrnamucopyfileobjucopyfileucopymodeucopystatucopyucopy2ucopytreeumoveurmtreeuErroruSpecialFileErroru ExecErrorumake_archiveuget_archive_formatsuregister_archive_formatuunregister_archive_formatuget_unpack_formatsuregister_unpack_formatuunregister_unpack_formatuunpack_archiveuignore_patternsuchownuwhichcBs|EeZdZdS(uErrorN(u__name__u
__module__u__qualname__(u
__locals__((u+/opt/alt/python33/lib64/python3.3/shutil.pyuError*scBs|EeZdZdZdS(uSpecialFileErroru|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)N(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u+/opt/alt/python33/lib64/python3.3/shutil.pyuSpecialFileError-scBs|EeZdZdZdS(u ExecErroru+Raised when a command could not be executedN(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u+/opt/alt/python33/lib64/python3.3/shutil.pyu ExecError1scBs|EeZdZdZdS(u ReadErroru%Raised when an archive cannot be readN(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u+/opt/alt/python33/lib64/python3.3/shutil.pyu ReadError4su ReadErrorcBs|EeZdZdZdS(u
RegistryErroruWRaised when a registry operation with the archiving
and unpacking registeries failsN(u__name__u
__module__u__qualname__u__doc__(u
__locals__((u+/opt/alt/python33/lib64/python3.3/shutil.pyu
RegistryError7su
RegistryErroriicCs0x)|j|�}|sPn|j|�qdS(u=copy data from file-like object fsrc to file-like object fdstN(ureaduwrite(ufsrcufdstulengthubuf((u+/opt/alt/python33/lib64/python3.3/shutil.pyucopyfileobjAs
cCsttjd�rEytjj||�SWqEtk
rAdSYqEXntjjtjj|��tjjtjj|��kS(NusamefileF(uhasattruosupathusamefileuOSErroruFalseunormcaseuabspath(usrcudst((u+/opt/alt/python33/lib64/python3.3/shutil.pyu _samefileIs
u _samefileufollow_symlinkscCst||�r(td||f��nxa||gD]S}ytj|�}Wntk
rbYq5Xtj|j�r5td|��q5q5W|r�tjj |�r�tj
tj|�|�n=t|d��,}t|d��}t
||�WdQXWdQX|S(u�Copy data from src to dst.
If follow_symlinks is not set and src is a symbolic link, a new
symlink will be created instead of copying the file it points to.
u`%s` and `%s` are the same fileu`%s` is a named pipeurbuwbN(u _samefileuErroruosustatuOSErroruS_ISFIFOust_modeuSpecialFileErrorupathuislinkusymlinkureadlinkuopenucopyfileobj(usrcudstufollow_symlinksufnustufsrcufdst((u+/opt/alt/python33/lib64/python3.3/shutil.pyucopyfileUs
cCs�|rWtjj|�rWtjj|�rWttd�rPtjtj}}q�dSn)ttd�r|tjtj}}ndS||�}||tj|j ��dS(u�Copy mode bits from src to dst.
If follow_symlinks is not set, symlinks aren't followed if and only
if both `src` and `dst` are symlinks. If `lchmod` isn't available
(e.g. Linux) this method does nothing.
ulchmodNuchmod(
uosupathuislinkuhasattrulstatulchmodustatuchmoduS_IMODEust_mode(usrcudstufollow_symlinksu stat_funcu
chmod_funcust((u+/opt/alt/python33/lib64/python3.3/shutil.pyucopymoders+u listxattrcCs�ytj|d|�}WnJtk
re}z*|jtjtjfkrO�ndSWYdd}~XnXx�|D]�}y5tj||d|�}tj|||d|�Wqmtk
r�}z,|jtjtjtjfkr��nWYdd}~XqmXqmWdS(u�Copy extended filesystem attributes from `src` to `dst`.
Overwrite existing attributes.
If `follow_symlinks` is false, symlinks won't be followed.
ufollow_symlinksN( uosu listxattruOSErroruerrnouENOTSUPuENODATAugetxattrusetxattruEPERM(usrcudstufollow_symlinksunamesueunameuvalue((u+/opt/alt/python33/lib64/python3.3/shutil.pyu
_copyxattr�s
!u
_copyxattrcOsdS(N((uargsukwargs((u+/opt/alt/python33/lib64/python3.3/shutil.pyu
_copyxattr�sc s�dddddd��|p@tjj|�o?tjj|�}|r^�fdd�}n�fdd�}|d�|d|�}tj|j�}|d �|d|j|jfd|�y|d
�||d|�Wnt k
r�YnXt
|d�r�y |d�||jd|�Wq�tk
r�}zDx<dD]1}t
t
|�r?|j
tt
|�kr?Pq?q?W�WYdd}~Xq�Xnt||d|�dS(u�Copy all stat info (mode bits, atime, mtime, flags) from src to dst.
If the optional flag `follow_symlinks` is not set, symlinks aren't followed if and
only if both `src` and `dst` are symlinks.
unsufollow_symlinkscWsdS(N((unsufollow_symlinksuargs((u+/opt/alt/python33/lib64/python3.3/shutil.pyu_nop�sucopystat.<locals>._nopcstt|��S(N(ugetattruos(uname(u_nop(u+/opt/alt/python33/lib64/python3.3/shutil.pyulookup�sucopystat.<locals>.lookupcs)tt|��}|tjkr%|S�S(N(ugetattruosusupports_follow_symlinks(unameufn(u_nop(u+/opt/alt/python33/lib64/python3.3/shutil.pyulookup�sustatuutimeuchmodust_flagsuchflagsu
EOPNOTSUPPuENOTSUPN(u
EOPNOTSUPPuENOTSUP(uNoneuosupathuislinkustatuS_IMODEust_modeust_atime_nsust_mtime_nsuNotImplementedErroruhasattrust_flagsuOSErroruerrnougetattru
_copyxattr( usrcudstufollow_symlinksufollowulookupustumodeuwhyuerr((u_nopu+/opt/alt/python33/lib64/python3.3/shutil.pyucopystat�s,+!
'cCs`tjj|�r6tjj|tjj|��}nt||d|�t||d|�|S(u�Copy data and mode bits ("cp src dst"). Return the file's destination.
The destination may be a directory.
If follow_symlinks is false, symlinks won't be followed. This
resembles GNU's "cp -P src dst".
ufollow_symlinks(uosupathuisdirujoinubasenameucopyfileucopymode(usrcudstufollow_symlinks((u+/opt/alt/python33/lib64/python3.3/shutil.pyucopy�s
$cCs`tjj|�r6tjj|tjj|��}nt||d|�t||d|�|S(u�Copy data and all stat info ("cp -p src dst"). Return the file's
destination."
The destination may be a directory.
If follow_symlinks is false, symlinks won't be followed. This
resembles GNU's "cp -P src dst".
ufollow_symlinks(uosupathuisdirujoinubasenameucopyfileucopystat(usrcudstufollow_symlinks((u+/opt/alt/python33/lib64/python3.3/shutil.pyucopy2�s
$cs�fdd�}|S(u�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(uextendufnmatchufilteruset(upathunamesu
ignored_namesupattern(upatterns(u+/opt/alt/python33/lib64/python3.3/shutil.pyu_ignore_patterns�s
u)ignore_patterns.<locals>._ignore_patterns((upatternsu_ignore_patterns((upatternsu+/opt/alt/python33/lib64/python3.3/shutil.pyuignore_patterns�scCsWtj|�}|dk r-|||�}n t�}tj|�g}x|D]w} | |krhqPntjj|| �}
tjj|| �}y�tjj|
�rtj|
�}|r�tj ||�t
|
|d|�qJtjj|�r|rwPn||
|�n8tjj|
�r=t
|
||||�n
||
|�WqPtk
r�}
z|j|
jd�WYdd}
~
XqPtk
r�}z!|j|
|t|�f�WYdd}~XqPXqPWyt
||�Wn_tk
r=}z?tdk rt|t�rn|j||t|�f�WYdd}~XnX|rSt|��n|S(u�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.
ufollow_symlinksiN(uosulistdiruNoneusetumakedirsupathujoinuislinkureadlinkusymlinkucopystatuexistsuisdirucopytreeuErroruextenduargsuEnvironmentErroruappendustruOSErroruWindowsErroru
isinstance(usrcudstusymlinksuignoreu
copy_functionuignore_dangling_symlinksunamesu
ignored_namesuerrorsunameusrcnameudstnameulinktouerruwhy((u+/opt/alt/python33/lib64/python3.3/shutil.pyucopytreesH$
&3/c$Cs�y%tjj|�r$td��nWn2tk
rY|tjj|tj��dSYnXg}ytj|�}Wn.tjk
r�|tj|tj��YnXx�|D]�}tjj||�}ytj |�j
}Wntjk
r�d}YnXtj|�rt
||�q�ytj|�Wq�tjk
rZ|tj|tj��Yq�Xq�Wytj|�Wn.tjk
r�|tj|tj��YnXdS(Nu%Cannot call rmtree on a symbolic linki(uosupathuislinkuOSErrorusysuexc_infoulistdiruerrorujoinulstatust_modeustatuS_ISDIRu_rmtree_unsafeuunlinkurmdir(upathuonerrorunamesunameufullnameumode((u+/opt/alt/python33/lib64/python3.3/shutil.pyu_rmtree_unsafe[s6
"u_rmtree_unsafec
0Cs@g}ytj|�}WnGtk
rb}z'||_|tj|tj��WYdd}~XnXx�|D]�}tjj||�}y(tj|d|dd�}|j
}Wntk
r�d}YnXtj|�r�ytj|tj
d|�} Wn+tk
r#|tj|tj��Yq8Xz�tjj|tj| ��r�t| ||�ytj|d|�Wq�tk
r�|tj|tj��Yq�XnAytd��Wn.tk
r�|tjj|tj��YnXWdtj| �Xqjytj|d|�Wqjtk
r7|tj|tj��YqjXqjWdS(Nudir_fdufollow_symlinksiu%Cannot call rmtree on a symbolic linkF(uosulistdiruOSErrorufilenameusysuexc_infoupathujoinustatuFalseust_modeuS_ISDIRuopenuO_RDONLYusamestatufstatu_rmtree_safe_fdurmdiruislinkucloseuunlink(
utopfdupathuonerrorunamesuerrunameufullnameuorig_stumodeudirfd((u+/opt/alt/python33/lib64/python3.3/shutil.pyu_rmtree_safe_fd|sD ,
!
%
u_rmtree_safe_fdc!Cs�|rdd�}n|dkr0dd�}ntr�t|t�rWtj|�}nytj|�}Wn/tk
r�|tj|tj ��dSYnXytj
|tj�}Wn/tk
r�|tj|tj ��dSYnXz�tjj
|tj|��r]t|||�ytj|�Wq�tjk
rY|tj|tj ��Yq�XnAytd��Wn.tk
r�|tjj|tj ��YnXWdtj|�Xn
t||�SdS(u�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 platform and implementation dependent;
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((uargs((u+/opt/alt/python33/lib64/python3.3/shutil.pyuonerror�surmtree.<locals>.onerrorcWs�dS(N((uargs((u+/opt/alt/python33/lib64/python3.3/shutil.pyuonerror�sNu%Cannot call rmtree on a symbolic link(uNoneu_use_fd_functionsu
isinstanceubytesuosufsdecodeulstatu Exceptionusysuexc_infouopenuO_RDONLYupathusamestatufstatu_rmtree_safe_fdurmdiruerroruOSErroruislinkucloseu_rmtree_unsafe(upathu
ignore_errorsuonerroruorig_stufd((u+/opt/alt/python33/lib64/python3.3/shutil.pyurmtree�s<
!
%cCs5tjjtjjpd}tjj|j|��S(Nu(uosupathusepualtsepubasenameurstrip(upathusep((u+/opt/alt/python33/lib64/python3.3/shutil.pyu _basename�su _basenamecCs`|}tjj|�r~t||�r;tj||�dStjj|t|��}tjj|�r~td|��q~nytj||�Wn�t k
r[tjj
|�r�tj|�}tj||�tj
|�nttjj|�r=t||�rtd||f��nt||dd�t|�nt||�tj
|�YnX|S(u0Recursively move a file or directory to another location. This is
similar to the Unix "mv" command. Return the file or directory's
destination.
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. Symlinks are
recreated under the new name if os.rename() fails because of cross
filesystem renames.
A lot more could be done here... A look at a mv.c shows a lot of
the issues this implementation glosses over.
Nu$Destination path '%s' already existsu.Cannot move a directory '%s' into itself '%s'.usymlinksT(uosupathuisdiru _samefileurenameujoinu _basenameuexistsuErroruOSErroruislinkureadlinkusymlinkuunlinku
_destinsrcucopytreeuTrueurmtreeucopy2(usrcudstureal_dstulinkto((u+/opt/alt/python33/lib64/python3.3/shutil.pyumove�s.
cCsut|�}t|�}|jtjj�s@|tjj7}n|jtjj�sh|tjj7}n|j|�S(N(uabspathuendswithuosupathusepu
startswith(usrcudst((u+/opt/alt/python33/lib64/python3.3/shutil.pyu
_destinsrcsu
_destinsrccCs_tdks|dkrdSyt|�}Wntk
rFd}YnX|dk r[|dSdS(u"Returns a gid, given a group name.iN(ugetgrnamuNoneuKeyError(unameuresult((u+/opt/alt/python33/lib64/python3.3/shutil.pyu_get_gid$s
u_get_gidcCs_tdks|dkrdSyt|�}Wntk
rFd}YnX|dk r[|dSdS(u"Returns an uid, given a user name.iN(ugetpwnamuNoneuKeyError(unameuresult((u+/opt/alt/python33/lib64/python3.3/shutil.pyu_get_uid0s
u_get_uidugzipcsidd6dd6}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�������fdd
�}|s{t
j|
d||�}
z|
j|d|�Wd|
j�Xn|
S(u�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.
ugzugzipuu.gzubz2ubzip2u.bz2uCbad value for 'compress', or compression format not supported : {0}u.tarucreating %suCreating tar archivecsF�dk r!�|_�|_n�dk rB�|_�|_n|S(N(uNoneugidugnameuuiduuname(utarinfo(ugidugroupuowneruuid(u+/opt/alt/python33/lib64/python3.3/shutil.pyu_set_uid_gidhs u#_make_tarball.<locals>._set_uid_giduw|%sufilterN(uNoneu_BZ2_SUPPORTEDu
ValueErroruformatugetuosupathudirnameuexistsuinfoumakedirsu_get_uidu_get_gidutarfileuopenuadduclose(u base_nameubase_dirucompressuverboseudry_runuownerugroupuloggerutar_compressionucompress_extuarchive_nameuarchive_diru_set_uid_gidutar((ugidugroupuowneruuidu+/opt/alt/python33/lib64/python3.3/shutil.pyu
_make_tarball<s4
u
_make_tarballcCs~|rd}nd}ddlm}ddlm}y |d|||gd|�Wn"|k
rytd�|�YnXdS( Nu-ru-rqi(uDistutilsExecError(uspawnuzipudry_runukunable to create zip file '%s': could neither import the 'zipfile' module nor find a standalone zip utility(udistutils.errorsuDistutilsExecErrorudistutils.spawnuspawnu ExecError(ubase_diruzip_filenameuverboseudry_runu
zipoptionsuDistutilsExecErroruspawn((u+/opt/alt/python33/lib64/python3.3/shutil.pyu_call_external_zipzs
u_call_external_zipcCs�|d}tjj|�}tjj|�sf|dk rM|jd|�n|sftj|�qfnyddl}Wntk
r�d}YnX|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�qqWq WWdQXn|S( umCreate 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.
u.zipucreating %siNu#creating '%s' and adding '%s' to ituwucompressionuadding '%s'(uosupathudirnameuexistsuNoneuinfoumakedirsuzipfileuImportErroru_call_external_zipuZipFileuZIP_DEFLATEDuwalkunormpathujoinuisfileuwrite(u base_nameubase_diruverboseudry_runuloggeruzip_filenameuarchive_diruzipfileuzfudirpathudirnamesu filenamesunameupath((u+/opt/alt/python33/lib64/python3.3/shutil.pyu
_make_zipfile�s6
!'u
_make_zipfileucompressugzip'ed tar-fileugztaruuncompressed tar fileutaruZIP fileuzipubzip2ubzip2'ed tar-fileubztarcCs'dd�tj�D�}|j�|S(u�Returns a list of supported formats for archiving and unarchiving.
Each element of the returned sequence is a tuple (name, description)
cSs&g|]\}}||df�qS(i((u.0unameuregistry((u+/opt/alt/python33/lib64/python3.3/shutil.pyu
<listcomp>�s u'get_archive_formats.<locals>.<listcomp>(u_ARCHIVE_FORMATSuitemsusort(uformats((u+/opt/alt/python33/lib64/python3.3/shutil.pyuget_archive_formats�s
ucCs�|dkrg}nt|�s4td|��nt|ttf�sXtd��nxE|D]=}t|ttf�s�t|�dkr_td��q_q_W|||ft|<dS(uuRegisters 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.
uThe %s object is not callableu!extra_args needs to be a sequenceiu+extra_args elements are : (arg_name, value)N(uNoneucallableu TypeErroru
isinstanceutupleulistulenu_ARCHIVE_FORMATS(unameufunctionu
extra_argsudescriptionuelement((u+/opt/alt/python33/lib64/python3.3/shutil.pyuregister_archive_format�s
(cCst|=dS(N(u_ARCHIVE_FORMATS(uname((u+/opt/alt/python33/lib64/python3.3/shutil.pyuunregister_archive_format�sc Csltj�} |d
k rb|d
k r7|jd|�ntjj|�}|sbtj|�qbn|d
krztj}ni|d6|d6}
yt|}Wn"t k
r�t
d|��YnX|d}x"|dD]\}
}||
|
<q�W|dkr||
d<||
d <nz||||
�}Wd
|d
k rg|d
k rW|jd| �ntj| �nX|S(u�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.
uchanging into '%s'udry_runuloggeruunknown archive format '%s'iiuzipuownerugroupNuchanging back to '%s'(uosugetcwduNoneudebugupathuabspathuchdirucurdiru_ARCHIVE_FORMATSuKeyErroru
ValueError(u base_nameuformaturoot_dirubase_diruverboseudry_runuownerugroupuloggerusave_cwdukwargsuformat_infoufuncuarguvalufilename((u+/opt/alt/python33/lib64/python3.3/shutil.pyumake_archive�s6
cCs'dd�tj�D�}|j�|S(u�Returns a list of supported formats for unpacking.
Each element of the returned sequence is a tuple
(name, extensions, description)
cSs-g|]#\}}||d|df�qS(ii((u.0unameuinfo((u+/opt/alt/python33/lib64/python3.3/shutil.pyu
<listcomp>!s u&get_unpack_formats.<locals>.<listcomp>(u_UNPACK_FORMATSuitemsusort(uformats((u+/opt/alt/python33/lib64/python3.3/shutil.pyuget_unpack_formatss
c Cs�i}x9tj�D]+\}}x|dD]}|||<q*WqWx=|D]5}||krId}t||||f��qIqIWt|�s�td��ndS(u+Checks what gets registered as an unpacker.iu!%s is already registered for "%s"u*The registered function must be a callableN(u_UNPACK_FORMATSuitemsu
RegistryErrorucallableu TypeError( u
extensionsufunctionu
extra_argsuexisting_extensionsunameuinfouextu extensionumsg((u+/opt/alt/python33/lib64/python3.3/shutil.pyu_check_unpack_options&s
u_check_unpack_optionscCs?|dkrg}nt|||�||||ft|<dS(uMRegisters 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(uNoneu_check_unpack_optionsu_UNPACK_FORMATS(unameu
extensionsufunctionu
extra_argsudescription((u+/opt/alt/python33/lib64/python3.3/shutil.pyuregister_unpack_format8s cCst|=dS(u+Removes the pack format from the registery.N(u_UNPACK_FORMATS(uname((u+/opt/alt/python33/lib64/python3.3/shutil.pyuunregister_unpack_formatNscCs8tjj|�}tjj|�s4tj|�ndS(u1Ensure that the parent directory of `path` existsN(uosupathudirnameuisdirumakedirs(upathudirname((u+/opt/alt/python33/lib64/python3.3/shutil.pyu_ensure_directoryRsu_ensure_directoryc CsByddl}Wntk
r0td��YnX|j|�sStd|��n|j|�}z�x�|j�D]�}|j}|jd�srd|kr�qrntj j
||jd��}|s�qrnt|�|j
d�sr|j|j�}t|d�}z|j|�Wd|j�~XqrqrWWd|j�XdS(u+Unpack zip `filename` to `extract_dir`
iNu/zlib not supported, cannot unpack this archive.u%s is not a zip fileu/u..uwb(uzipfileuImportErroru ReadErroru
is_zipfileuZipFileuinfolistufilenameu
startswithuosupathujoinusplitu_ensure_directoryuendswithureaduopenuwriteuclose( ufilenameuextract_diruzipfileuzipuinfounameutargetudatauf((u+/opt/alt/python33/lib64/python3.3/shutil.pyu_unpack_zipfileXs0
u_unpack_zipfilecCs^ytj|�}Wn%tjk
r:td|��YnXz|j|�Wd|j�XdS(u:Unpack tar/tar.gz/tar.bz2 `filename` to `extract_dir`
u/%s is not a compressed or uncompressed tar fileN(utarfileuopenuTarErroru ReadErroru
extractalluclose(ufilenameuextract_dirutarobj((u+/opt/alt/python33/lib64/python3.3/shutil.pyu_unpack_tarfile}su_unpack_tarfileu.tar.gzu.tgzu.taru.zipu.bz2cCsIxBtj�D]4\}}x%|dD]}|j|�r$|Sq$Wq
WdS(Ni(u_UNPACK_FORMATSuitemsuendswithuNone(ufilenameunameuinfou extension((u+/opt/alt/python33/lib64/python3.3/shutil.pyu_find_unpack_format�s
u_find_unpack_formatcCs�|dkrtj�}n|dk r�yt|}Wn'tk
r^tdj|���YnX|d}|||t|d��nbt|�}|dkr�t dj|���nt|d}tt|d�}||||�dS(u�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.
uUnknown unpack format '{0}'iiuUnknown archive format '{0}'N(
uNoneuosugetcwdu_UNPACK_FORMATSuKeyErroru
ValueErroruformatudictu_find_unpack_formatu ReadError(ufilenameuextract_diruformatuformat_infoufuncukwargs((u+/opt/alt/python33/lib64/python3.3/shutil.pyuunpack_archive�s
ustatvfsu
disk_usageuusageutotal used freecCsVtj|�}|j|j}|j|j}|j|j|j}t|||�S(u�Return disk usage statistics about the given path.
Returned value is a named tuple with attributes 'total', 'used' and
'free', which are the amount of total, used and free space, in bytes.
(uosustatvfsuf_bavailuf_frsizeuf_blocksuf_bfreeu_ntuple_diskusage(upathustufreeutotaluused((u+/opt/alt/python33/lib64/python3.3/shutil.pyu
disk_usage�s
untcCs/tj|�\}}||}t|||�S(u�Return disk usage statistics about the given path.
Returned values is a named tuple with attributes 'total', 'used' and
'free', which are the amount of total, used and free space, in bytes.
(untu
_getdiskusageu_ntuple_diskusage(upathutotalufreeuused((u+/opt/alt/python33/lib64/python3.3/shutil.pyu
disk_usage�s
cCs�|dkr'|dkr'td��n|}|}|dkrHd}nBt|t�r�t|�}|dkr�tdj|���q�n|dkr�d}nBt|t�s�t|�}|dkr�tdj|���q�nt j
|||�dS(u�Change owner user and group of the given path.
user and group can be the uid/gid or the user/group names, and in that case,
they are converted to their respective uid/gid.
uuser and/or group must be setiuno such user: {!r}uno such group: {!r}Ni����i����(uNoneu
ValueErroru
isinstanceustru_get_uiduLookupErroruformatuintu_get_giduosuchown(upathuuserugroupu_useru_group((u+/opt/alt/python33/lib64/python3.3/shutil.pyuchown�s" iPicCsyttjd�}Wnttfk
r7d}YnXyttjd�}Wnttfk
rod}YnX|dks�|dkrytjtjj��}Wn't t
fk
r�tj|�}YnX|dkr�|j}n|dkr|j
}qntj||f�S(uGet the size of the terminal window.
For each of the two dimensions, the environment variable, COLUMNS
and LINES respectively, is checked. If the variable is defined and
the value is a positive integer, it is used.
When COLUMNS or LINES is not defined, which is the common case,
the terminal connected to sys.__stdout__ is queried
by invoking os.get_terminal_size.
If the terminal size cannot be successfully queried, either because
the system doesn't support querying, or because we are not
connected to a terminal, the value given in fallback parameter
is used. Fallback defaults to (80, 24) which is the default
size used by many terminal emulators.
The value returned is a named tuple of type os.terminal_size.
uCOLUMNSiuLINES(uintuosuenvironuKeyErroru
ValueErroruget_terminal_sizeusysu
__stdout__ufilenou NameErroruOSErroru
terminal_sizeucolumnsulines(ufallbackucolumnsulinesusize((u+/opt/alt/python33/lib64/python3.3/shutil.pyuget_terminal_sizes$uget_terminal_sizecs�dd�}tjj��r5|�|�r1�SdS|dkr\tjjdtj�}n|sfdS|jtj�}t j
dkrtj|kr�|jdtj�ntjjdd�jtj�}t
�fdd �|D��r��g}q�fd
d�|D�}n �g}t�}xu|D]m}tjj|�}||kr-|j|�x9|D].} tjj|| �}
||
|�re|
SqeWq-q-WdS(
u3Given a command, mode, and a PATH string, return the path which
conforms to the given mode on the PATH, or None if there is no such
file.
`mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result
of os.environ.get("PATH"), or can be overridden with a custom search
path.
cSs5tjj|�o4tj||�o4tjj|�S(N(uosupathuexistsuaccessuisdir(ufnumode((u+/opt/alt/python33/lib64/python3.3/shutil.pyu
_access_check9s$uwhich.<locals>._access_checkuPATHuwin32iuPATHEXTuc3s*|] }�j�j|j��VqdS(N(uloweruendswith(u.0uext(ucmd(u+/opt/alt/python33/lib64/python3.3/shutil.pyu <genexpr>Vsuwhich.<locals>.<genexpr>csg|]}�|�qS(((u.0uext(ucmd(u+/opt/alt/python33/lib64/python3.3/shutil.pyu
<listcomp>Ys uwhich.<locals>.<listcomp>N(uosupathudirnameuNoneuenvironugetudefpathusplitupathsepusysuplatformucurdiruinsertuanyusetunormcaseuaddujoin(ucmdumodeupathu
_access_checkupathextufilesuseenudirunormdiruthefileuname((ucmdu+/opt/alt/python33/lib64/python3.3/shutil.pyuwhich,s8
!
TFi@(ucompressugzip(ucompressN(ucompressubzip2(iPi(Wu__doc__uosusysustatuos.pathuabspathufnmatchucollectionsuerrnoutarfileubz2uTrueu_BZ2_SUPPORTEDuImportErroruFalseupwdugetpwnamuNoneugrpugetgrnamu__all__uEnvironmentErroruErroruSpecialFileErroru ExecErroru ReadErroru Exceptionu
RegistryErroruWindowsErroru NameErrorucopyfileobju _samefileucopyfileucopymodeuhasattru
_copyxattrucopystatucopyucopy2uignore_patternsucopytreeu_rmtree_unsafeu_rmtree_safe_fduopenuunlinkurmdirusupports_dir_fdulistdirusupports_fdusupports_follow_symlinksu_use_fd_functionsurmtreeuavoids_symlink_attacksu _basenameumoveu
_destinsrcu_get_gidu_get_uidu
_make_tarballu_call_external_zipu
_make_zipfileu_ARCHIVE_FORMATSuget_archive_formatsuregister_archive_formatuunregister_archive_formatumake_archiveuget_unpack_formatsu_check_unpack_optionsuregister_unpack_formatuunregister_unpack_formatu_ensure_directoryu_unpack_zipfileu_unpack_tarfileu_UNPACK_FORMATSu_find_unpack_formatuunpack_archiveuappendu
namedtupleu_ntuple_diskusageu
disk_usageunameuntuchownuget_terminal_sizeuF_OKuX_OKuwhich(((u+/opt/alt/python33/lib64/python3.3/shutil.pyu<module>s�
6 W!,5 1 =-
6%
%
+
?>