-í
ì¶<c       sŠ   d  Z  d Z d k Z d k l Z h  d e <d d <d d <Z d	 d
 d „ Z d d d e d d d „ Z d d d „ Z	 d „  Z
 d S(   sF   distutils.file_util

Utility functions for operating on single files.
s:   $Id: file_util.py,v 1.11.6.1 2002/02/22 13:22:55 mwh Exp $N(   s   DistutilsFileErrors   copyings   hard linkings   hards   symbolically linkings   symi   i   c    sÔ  t  } t  } z–y t |  d ƒ } Wn1 t i j
 o" \ } } t	 d |  | f ‚ n Xt i
 i | ƒ oI y t i | ƒ Wn1 t i j
 o" \ } } t	 d | | f ‚ n Xn y t | d ƒ } Wn1 t i j
 o" \ } } t	 d | | f ‚ n Xx¥ d o y | i | ƒ } Wn1 t i j
 o" \ } } t	 d |  | f ‚ n X| o Pn y | i | ƒ Wn1 t i j
 o" \ } } t	 d | | f ‚ n Xqü WWd	 | o | i ƒ  n | o | i ƒ  n Xd	 S(
   s5  Copy 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.
    s   rbs   could not open '%s': %ss   could not delete '%s': %ss   wbs   could not create '%s': %si   s   could not read from '%s': %ss   could not write to '%s': %sN(   s   Nones   fsrcs   fdsts   opens   srcs   oss   errors   errnos   errstrs   DistutilsFileErrors   paths   existss   dsts   unlinks   reads   buffer_sizes   bufs   writes   close(   s   srcs   dsts   buffer_sizes   bufs   errnos   fdsts   fsrcs   errstr(    (    s)   /usr/lib/python2.2/distutils/file_util.pys   _copy_file_contents sD      ! i   i    c    s  d k  l }
 d k l } l } l }	 l } t i i	 |  ƒ o t d |  ‚ n t i i | ƒ o+ | } t i i | t i i |  ƒ ƒ } n t i i | ƒ } | o |
 |  | ƒ o" | o d |  GHn | d f Sn y t | } Wn  t j
 o t d | ‚ n X| oQ t i i | ƒ t i i |  ƒ j o d | |  | f GHn d | |  | f GHn | o | d f Sn t i d	 j o\ d
 k } y | i |  | d | ƒ Wn2 t i j
 o# } t d |  | | d f ‚ n Xn| d j oB t i i  | ƒ o t i i! |  | ƒ o t i |  | ƒ n nÌ | d j oB t i i  | ƒ o t i i! |  | ƒ o t i" |  | ƒ n n} t# |  | ƒ | p | oa t i |  ƒ } | o" t i& | | | | | f ƒ n | o t i' | | | |	 ƒ ƒ n n | d f Sd
 S(   s;  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'.  If 'verbose' is true, then a one-line summary of the
    copy will be printed to stdout.

    '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).
    (   s   newer(   s   ST_ATIMEs   ST_MTIMEs   ST_MODEs   S_IMODEs4   can't copy '%s': doesn't exist or not a regular files"   not copying %s (output up-to-date)i    s&   invalid value '%s' for 'link' arguments   %s %s -> %si   s   macNs   could not copy '%s' to '%s': %siÿÿÿÿs   hards   sym((   s   distutils.dep_utils   newers   stats   ST_ATIMEs   ST_MTIMEs   ST_MODEs   S_IMODEs   oss   paths   isfiles   srcs   DistutilsFileErrors   isdirs   dsts   dirs   joins   basenames   dirnames   updates   verboses   _copy_actions   links   actions   KeyErrors
   ValueErrors   dry_runs   names
   macostoolss   copys   preserve_timess   errors   excs   existss   samefiles   symlinks   _copy_file_contentss   preserve_modes   sts   utimes   chmod(   s   srcs   dsts   preserve_modes   preserve_timess   updates   links   verboses   dry_runs   ST_MTIMEs   ST_MODEs   newers   S_IMODEs   excs   ST_ATIMEs   sts   dirs   actions
   macostools(    (    s)   /usr/lib/python2.2/distutils/file_util.pys	   copy_fileM sV     %%	#**""c    sõ  d k  l } l }
 l } l } l }	 d k } | o d |  | f GHn | o | Sn |
 |  ƒ o t d |  ‚ n | | ƒ o t i i | | |  ƒ ƒ } n% | | ƒ o t d |  | f ‚ n | |	 | ƒ ƒ o t d |  | f ‚ n d } y t i |  | ƒ WnN t i j
 o? \ } } | | i j o
 d } n t d	 |  | | f ‚ n X| oŠ t |  | ƒ y t i |  ƒ Wne t i j
 oV \ } } y t i | ƒ Wn t i j
 o n Xt d
 d |  | |  | f ‚ n Xn | Sd S(   s%  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???
    (   s   existss   isfiles   isdirs   basenames   dirnameNs   moving %s -> %ss#   can't move '%s': not a regular files0   can't move '%s': destination '%s' already existss2   can't move '%s': destination '%s' not a valid pathi    i   s   couldn't move '%s' to '%s': %ss+   couldn't move '%s' to '%s' by copy/delete: s   delete '%s' failed: %s(   s   os.paths   existss   isfiles   isdirs   basenames   dirnames   errnos   verboses   srcs   dsts   dry_runs   DistutilsFileErrors   oss   paths   joins   copy_its   renames   errors   nums   msgs   EXDEVs	   copy_files   unlink(   s   srcs   dsts   verboses   dry_runs   isdirs   existss   errnos   nums   msgs   dirnames   isfiles   basenames   copy_it(    (    s)   /usr/lib/python2.2/distutils/file_util.pys	   move_fileº sB    
 %	
&c    s?   t  |  d ƒ } x | D] } | i | d ƒ q W| i ƒ  d S(   s{   Create a file with the specified name and write 'contents' (a
    sequence of strings without line terminators) to it.
    s   ws   
N(   s   opens   filenames   fs   contentss   lines   writes   close(   s   filenames   contentss   lines   f(    (    s)   /usr/lib/python2.2/distutils/file_util.pys
   write_fileû s      (   s   __doc__s   __revision__s   oss   distutils.errorss   DistutilsFileErrors   Nones   _copy_actions   _copy_file_contentss	   copy_files	   move_files
   write_file(   s	   move_files   DistutilsFileErrors   _copy_actions	   copy_files
   write_files   __revision__s   oss   _copy_file_contents(    (    s)   /usr/lib/python2.2/distutils/file_util.pys   ? s   	!9mA