;ς
ρό?c        
   @   sΥ   d  Z  d k Z d k Z d k Z d k Z d d d d d d d d	 d
 d g
 Z d e i f d     YZ d d d  Z d   Z	 d   Z
 d   Z d   Z d   Z e d  Z e e d  Z d   Z d   Z d S(   s   Utility functions for copying files and directory trees.

XXX The functions here don't copy the resource fork or other metadata on Mac.

Ns   copyfileobjs   copyfiles   copymodes   copystats   copys   copy2s   copytrees   moves   rmtrees   Errorc           B   s   t  Z RS(   N(   s   __name__s
   __module__(    (    (    s#   /mit/python/lib/python2.3/shutil.pys   Error   s   i   i   c         C   s<   x5 n o- |  i |  } | o Pn | i |  q
 Wd S(   s=   copy data from file-like object fsrc to file-like object fdsti   N(   s   fsrcs   reads   lengths   bufs   fdsts   write(   s   fsrcs   fdsts   lengths   buf(    (    s#   /mit/python/lib/python2.3/shutil.pys   copyfileobj   s      c         C   sΎ   t  } t  } t i i t i i |    } t i i t i i |   } | | j o d Sn z/ t |  d  } t | d  } t | |  Wd | o | i   n | o | i   n Xd S(   s   Copy data from src to dstNs   rbs   wb(   s   Nones   fsrcs   fdsts   oss   paths   normcases   abspaths   srcs   _srcs   dsts   _dsts   opens   copyfileobjs   close(   s   srcs   dsts   fdsts   _srcs   fsrcs   _dst(    (    s#   /mit/python/lib/python2.3/shutil.pys   copyfile   s       c         C   sI   t  t d  o5 t i |   } t i | i  } t i | |  n d S(   s   Copy mode bits from src to dsts   chmodN(
   s   hasattrs   oss   stats   srcs   sts   S_IMODEs   st_modes   modes   chmods   dst(   s   srcs   dsts   sts   mode(    (    s#   /mit/python/lib/python2.3/shutil.pys   copymode.   s
     c         C   sy   t  i |   } t i | i  } t t  d  o  t  i | | i
 | i f  n t t  d  o t  i | |  n d S(   s?   Copy all stat info (mode bits, atime and mtime) from src to dsts   utimes   chmodN(   s   oss   stats   srcs   sts   S_IMODEs   st_modes   modes   hasattrs   utimes   dsts   st_atimes   st_mtimes   chmod(   s   srcs   dsts   sts   mode(    (    s#   /mit/python/lib/python2.3/shutil.pys   copystat5   s      c         C   sV   t  i i |  o% t  i i | t  i i |    } n t |  |  t |  |  d S(   sV   Copy data and mode bits ("cp src dst").

    The destination may be a directory.

    N(	   s   oss   paths   isdirs   dsts   joins   basenames   srcs   copyfiles   copymode(   s   srcs   dst(    (    s#   /mit/python/lib/python2.3/shutil.pys   copy?   s
     %c         C   sV   t  i i |  o% t  i i | t  i i |    } n t |  |  t |  |  d S(   s]   Copy data and all stat info ("cp -p src dst").

    The destination may be a directory.

    N(	   s   oss   paths   isdirs   dsts   joins   basenames   srcs   copyfiles   copystat(   s   srcs   dst(    (    s#   /mit/python/lib/python2.3/shutil.pys   copy2J   s
     %c   
      C   s!  t  i |   } t  i |  g  } xδ | D]ά } t  i i	 |  |  } t  i i	 | |  } yu | o t  i i |  o# t  i |  }	 t  i |	 |  n5 t  i i |  o t | | |  n t | |  Wq) t t  i f j
 o } | i | | | f  q) Xq) W| o t |  n d S(   sΥ  Recursively copy a directory tree using copy2().

    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.

    XXX Consider this example code rather than the ultimate tool.

    N(   s   oss   listdirs   srcs   namess   mkdirs   dsts   errorss   names   paths   joins   srcnames   dstnames   symlinkss   islinks   readlinks   linktos   symlinks   isdirs   copytrees   copy2s   IOErrors   errors   whys   appends   Error(
   s   srcs   dsts   symlinkss   errorss   names   dstnames   whys   srcnames   namess   linkto(    (    s#   /mit/python/lib/python2.3/shutil.pys   copytreeV   s&      c         C   s»   g  } |  } y2 t |  |  x | D] \ } } | |  q# WWnv t j
 oj t i   } | o q· | t j	 o | | | |  q· | d | d d | d d d | f  n Xd S(   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; otherwise, an
    exception is raised.
    i    i   s
    removing N(   s	   cmdtupless   paths   args   _build_cmdtuples   funcs   OSErrors   syss   exc_infos   excs   ignore_errorss   onerrors   None(   s   paths   ignore_errorss   onerrors	   cmdtupless   funcs   args   exc(    (    s#   /mit/python/lib/python2.3/shutil.pys   rmtreex   s      c         C   s   xz t  i |   D]i } t  i i |  |  } t  i i |  o t  i i |  o t | |  q | i
 t  i | f  q W| i
 t  i |  f  d  S(   N(   s   oss   listdirs   paths   fs   joins   real_fs   isdirs   islinks   _build_cmdtuples	   cmdtupless   appends   removes   rmdir(   s   paths	   cmdtupless   fs   real_f(    (    s#   /mit/python/lib/python2.3/shutil.pys   _build_cmdtuple   s     'c         C   s|   y t  i |  |  Wna t j
 oU t  i i |   o! t |  | d t t	 |   qx t
 |  |  t  i |   n Xd S(   s=  Recursively move a file or directory to another location.

    If the destination is on our current filesystem, then simply use
    rename.  Otherwise, copy src to the dst and then remove src.
    A lot more could be done here...  A look at a mv.c shows a lot of
    the issues this implementation glosses over.

    s   symlinksN(   s   oss   renames   srcs   dsts   OSErrors   paths   isdirs   copytrees   Trues   rmtrees   copy2s   unlink(   s   srcs   dst(    (    s#   /mit/python/lib/python2.3/shutil.pys   move   s     (   s   __doc__s   oss   syss   stats
   exceptionss   __all__s   EnvironmentErrors   Errors   copyfileobjs   copyfiles   copymodes   copystats   copys   copy2s   Falses   copytrees   Nones   rmtrees   _build_cmdtuples   move(   s   moves   copyfiles   stats   copys   copymodes   __all__s   copy2s   copytrees   copystats   syss   _build_cmdtuples   rmtrees   Errors
   exceptionss   copyfileobjs   os(    (    s#   /mit/python/lib/python2.3/shutil.pys   ?   s    				$				
		"	
