Your IP : 3.145.61.142


Current Path : /opt/alt/python33/lib64/python3.3/distutils/__pycache__/
Upload File :
Current File : //opt/alt/python33/lib64/python3.3/distutils/__pycache__/file_util.cpython-33.pyc

�
��f�c@s�dZddlZddlmZddlmZidd6dd6dd	6Zddd
�Zdddddddd�Z	dddd�Z
dd�ZdS(uFdistutils.file_util

Utility functions for operating on single files.
iN(uDistutilsFileError(ulogucopyinguhard linkinguhardusymbolically linkingusymiicNCsd}d}z�yt|d�}WnAtjk
re}ztd||jf��WYdd}~XnXtjj|�r�ytj|�Wq�tjk
r�}ztd||jf��WYdd}~Xq�Xnyt|d�}WnAtjk
r&}ztd||jf��WYdd}~XnXx�y|j	|�}WnAtjk
r�}ztd||jf��WYdd}~XnX|s�Pny|j
|�Wq*tjk
r�}ztd||jf��WYdd}~Xq*Xq*Wd|r�|j�n|r
|j�nXdS(	u5Copy the file 'src' to 'dst'; both must be filenames.  Any error
    opening either file, reading from 'src', or writing to 'dst', raises
    DistutilsFileError.  Data is read/written in chunks of 'buffer_size'
    bytes (default 16k).  No attempt is made to handle anything apart from
    regular files.
    urbucould not open '%s': %sNucould not delete '%s': %suwbucould not create '%s': %sucould not read from '%s': %sucould not write to '%s': %s(uNoneuopenuosuerroruDistutilsFileErrorustrerrorupathuexistsuunlinkureaduwriteuclose(usrcudstubuffer_sizeufsrcufdstueubuf((u8/opt/alt/python33/lib64/python3.3/distutils/file_util.pyu_copy_file_contentssF	,,))0
u_copy_file_contentsicCs�ddlm}ddlm}	m}
m}m}tjj	|�sWt
d|��ntjj|�r�|}
tjj|tjj
|��}ntjj|�}
|r�|||�r�|dkr�tjd|�n|dfSyt|}Wn"tk
rtd|��YnX|dkrytjj
|�tjj
|�kr`tjd|||
�qytjd|||�n|r�|dfS|d	kr�tjj|�o�tjj||�s�tj||�q�n�|d
krtjj|�otjj||�s�tj||�q�nut||�|s4|r�tj|�}|rjtj|||	||
f�n|r�tj||||��q�n|dfS(u�Copy a file 'src' to 'dst'.  If 'dst' is a directory, then 'src' is
    copied there with the same name; otherwise, it must be a filename.  (If
    the file exists, it will be ruthlessly clobbered.)  If 'preserve_mode'
    is true (the default), the file's mode (type and permission bits, or
    whatever is analogous on the current platform) is copied.  If
    'preserve_times' is true (the default), the last-modified and
    last-access times are copied as well.  If 'update' is true, 'src' will
    only be copied if 'dst' does not exist, or if 'dst' does exist but is
    older than 'src'.

    'link' allows you to make hard links (os.link) or symbolic links
    (os.symlink) instead of copying: set it to "hard" or "sym"; if it is
    None (the default), files are copied.  Don't set 'link' on systems that
    don't support it: 'copy_file()' doesn't check if hard or symbolic
    linking is available.

    Under Mac OS, uses the native file copy function in macostools; on
    other systems, uses '_copy_file_contents()' to copy file contents.

    Return a tuple (dest_name, copied): 'dest_name' is the actual name of
    the output file, and 'copied' is true if the file was copied (or would
    have been copied, if 'dry_run' true).
    i(unewer(uST_ATIMEuST_MTIMEuST_MODEuS_IMODEu4can't copy '%s': doesn't exist or not a regular fileiu"not copying %s (output up-to-date)u&invalid value '%s' for 'link' argumentu%s %s -> %suhardusym(udistutils.dep_utilunewerustatuST_ATIMEuST_MTIMEuST_MODEuS_IMODEuosupathuisfileuDistutilsFileErroruisdirujoinubasenameudirnameulogudebugu_copy_actionuKeyErroru
ValueErroruinfouexistsusamefileulinkusymlinku_copy_file_contentsuutimeuchmod(usrcudstu
preserve_modeupreserve_timesuupdateulinkuverboseudry_rununeweruST_ATIMEuST_MTIMEuST_MODEuS_IMODEudiruactionust((u8/opt/alt/python33/lib64/python3.3/distutils/file_util.pyu	copy_fileCsJ "$

$
''
! u	copy_filec(Cs(ddlm}m}m}m}m}ddl}	|dkrVtjd||�n|r`|S||�st	d|��n||�r�t
jj|||��}n%||�r�t	d||f��n|||��s�t	d||f��nd}
yt
j||�Wnet
jk
rz}zB|\}}
||	jkrOd
}
nt	d	|||
f��WYdd}~XnX|
r$t||d
|�yt
j|�Wq$t
jk
r }zV|\}}
yt
j|�Wnt
jk
r�YnXt	d||||
f��WYdd}~Xq$Xn|S(u%Move a file 'src' to 'dst'.  If 'dst' is a directory, the file will
    be moved into it with the same name; otherwise, 'src' is just renamed
    to 'dst'.  Return the new full name of the file.

    Handles cross-device moves on Unix using 'copy_file()'.  What about
    other systems???
    i(uexistsuisfileuisdirubasenameudirnameNiumoving %s -> %su#can't move '%s': not a regular fileu0can't move '%s': destination '%s' already existsu2can't move '%s': destination '%s' not a valid pathucouldn't move '%s' to '%s': %suverboseuAcouldn't move '%s' to '%s' by copy/delete: delete '%s' failed: %sFT(uos.pathuexistsuisfileuisdirubasenameudirnameuerrnouloguinfouDistutilsFileErroruosupathujoinuFalseurenameuerroruEXDEVuTrueu	copy_fileuunlink(usrcudstuverboseudry_runuexistsuisfileuisdirubasenameudirnameuerrnoucopy_itueunumumsg((u8/opt/alt/python33/lib64/python3.3/distutils/file_util.pyu	move_file�sR(	),u	move_filec
CsGt|d�}z&x|D]}|j|d�qWWd|j�XdS(u{Create a file with the specified name and write 'contents' (a
    sequence of strings without line terminators) to it.
    uwu
N(uopenuwriteuclose(ufilenameucontentsufuline((u8/opt/alt/python33/lib64/python3.3/distutils/file_util.pyu
write_file�s

u
write_filei@(u__doc__uosudistutils.errorsuDistutilsFileErroru	distutilsuloguNoneu_copy_actionu_copy_file_contentsu	copy_fileu	move_fileu
write_file(((u8/opt/alt/python33/lib64/python3.3/distutils/file_util.pyu<module>s

3	[=

?>