ok

Mini Shell

Direktori : /lib64/python2.7/distutils/
Upload File :
Current File : //lib64/python2.7/distutils/dir_util.pyc

�
{fc@s�dZdZddlZddlZddlmZmZddlmZia	dddd	�Z
dddd
�Zddddddd�Zd�Z
ddd
�Zd�ZdS(sWdistutils.dir_util

Utility functions for manipulating directories and directory trees.s$Id$i����N(tDistutilsFileErrortDistutilsInternalError(tlogi�iicCs�t|t�s"td|f�ntjj|�}g}tjj|�sX|dkr\|Stjtjj	|��r{|Stjj
|�\}}|g}xK|r�|r�tjj|�r�tjj
|�\}}|jd|�q�Wx�|D]�}tjj||�}tjj	|�}	tj|	�r3q�n|dkrRt
jd|�n|s�ytj||�WnWtk
r�}
|
jtjko�tjj|�s�td||
jdf��q�nX|j|�ndt|	<q�W|S(s�Create a directory and any missing ancestor directories.

    If the directory already exists (or if 'name' is the empty string, which
    means the current directory, which of course exists), then do nothing.
    Raise DistutilsFileError if unable to create some directory along the way
    (eg. some sub-path exists, but is a file rather than a directory).
    If 'verbose' is true, print a one-line summary of each mkdir to stdout.
    Return the list of directories actually created.
    s(mkpath: 'name' must be a string (got %r)tiiscreating %sscould not create '%s': %si����(t
isinstancet
basestringRtostpathtnormpathtisdirt
_path_createdtgettabspathtsplittinserttjoinRtinfotmkdirtOSErrorterrnotEEXISTRtargstappend(tnametmodetverbosetdry_runtcreated_dirstheadttailttailstdtabs_headtexc((s*/usr/lib64/python2.7/distutils/dir_util.pytmkpaths>	"
$!c	Cs�i}x3|D]+}d|tjj|tjj|��<q
W|j�}|j�x'|D]}t||d|d|�qYWdS(s�Create all the empty directories under 'base_dir' needed to put 'files'
    there.

    'base_dir' is just the name of a directory which doesn't necessarily
    exist yet; 'files' is a list of filenames to be interpreted relative to
    'base_dir'.  'base_dir' + the directory portion of every file in 'files'
    will be created if it doesn't already exist.  'mode', 'verbose' and
    'dry_run' flags are as for 'mkpath()'.
    iRRN(RRRtdirnametkeystsortR"(	tbase_dirtfilesRRRtneed_dirtfilet	need_dirstdir((s*/usr/lib64/python2.7/distutils/dir_util.pytcreate_treeRs
)

c
Cs�ddlm}|r:tjj|�r:td|�nytj|�}	Wn>tjk
r�\}
}|rwg}	q�td||f�nX|s�t|d|�ng}x1|	D])}
tjj	||
�}tjj	||
�}|
j
d�r�q�n|rktjj|�rktj|�}|dkrBt
jd||�n|s[tj||�n|j|�q�tjj|�r�|jt||||||d|d	|��q�||||||d|d	|�|j|�q�W|S(
sCopy an entire directory tree 'src' to a new location 'dst'.

    Both 'src' and 'dst' must be directory names.  If 'src' is not a
    directory, raise DistutilsFileError.  If 'dst' does not exist, it is
    created with 'mkpath()'.  The end result of the copy is that every
    file in 'src' is copied to 'dst', and directories under 'src' are
    recursively copied to 'dst'.  Return the list of files that were
    copied or might have been copied, using their output name.  The
    return value is unaffected by 'update' or 'dry_run': it is simply
    the list of all files under 'src', with the names changed to be
    under 'dst'.

    'preserve_mode' and 'preserve_times' are the same as for
    'copy_file'; note that they only apply to regular files, not to
    directories.  If 'preserve_symlinks' is true, symlinks will be
    copied as symlinks (on platforms that support them!); otherwise
    (the default), the destination of the symlink will be copied.
    'update' and 'verbose' are the same as for 'copy_file'.
    i����(t	copy_files&cannot copy tree '%s': not a directoryserror listing files in '%s': %sRs.nfsislinking %s -> %sR(tdistutils.file_utilR-RRR	RtlistdirterrorR"Rt
startswithtislinktreadlinkRRtsymlinkRtextendt	copy_tree(tsrctdstt
preserve_modetpreserve_timestpreserve_symlinkstupdateRRR-tnamesRterrstrtoutputstntsrc_nametdst_namet	link_dest((s*/usr/lib64/python2.7/distutils/dir_util.pyR6gsH
	
cCs�xwtj|�D]f}tjj||�}tjj|�r`tjj|�r`t||�q|jtj|f�qW|jtj	|f�dS(sHelper for remove_tree().N(
RR/RRR	R2t_build_cmdtupleRtremovetrmdir(Rt	cmdtuplestftreal_f((s*/usr/lib64/python2.7/distutils/dir_util.pyRD�s%cCs�|dkrtjd|�n|r)dSg}t||�x|D]w}yB|d|d�tjj|d�}|tkr�t|=nWqCttfk
r�}tj	d||�qCXqCWdS(s�Recursively remove an entire directory tree.

    Any errors are ignored (apart from being reported to stdout if 'verbose'
    is true).
    is'removing '%s' (and everything under it)Niserror removing %s: %s(
RRRDRRRR
tIOErrorRtwarn(t	directoryRRRGtcmdRR!((s*/usr/lib64/python2.7/distutils/dir_util.pytremove_tree�s

cCsCtjj|�\}}|dd!tjkr?||d}n|S(s�Take the full path 'path', and make it a relative path.

    This is useful to make 'path' the second argument to os.path.join().
    ii(RRt
splitdrivetsep(Rtdrive((s*/usr/lib64/python2.7/distutils/dir_util.pytensure_relative�s(t__doc__t__revision__RRtdistutils.errorsRRt	distutilsRR
R"R,R6RDRNRR(((s*/usr/lib64/python2.7/distutils/dir_util.pyt<module>s?D	


Zerion Mini Shell 1.0