ž «ÿf‚ c @ sœ d Z d d l Z d d l m Z d d l m Z i d d 6d d 6d d 6Z d d d „ Z d d d d d d d d „ Z d d d d „ Z d d „ Z d S( uF distutils.file_util Utility functions for operating on single files. i N( u DistutilsFileError( u logu copyingu hard linkingu hardu symbolically linkingu symi i c N C s d } d } zØy t | d ƒ } WnA t j k re } z t d | | j f ƒ ‚ WYd d } ~ Xn Xt j j | ƒ rÐ y t j | ƒ WqÐ t j k rÌ } z t d | | j f ƒ ‚ WYd d } ~ XqÐ Xn y t | d ƒ } WnA t j k r&} z t d | | j f ƒ ‚ WYd d } ~ Xn Xx¹ y | j | ƒ } WnA t j k r€} z t d | | j f ƒ ‚ WYd d } ~ Xn X| s‹Pn y | j | ƒ Wq*t j k rß} z t d | | j f ƒ ‚ WYd d } ~ Xq*Xq*Wd | rú| j ƒ n | r | j ƒ n Xd S( u5 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. u rbu could not open '%s': %sNu could not delete '%s': %su wbu could not create '%s': %su could not read from '%s': %su could not write to '%s': %s( u Noneu openu osu erroru DistutilsFileErroru strerroru pathu existsu unlinku readu writeu close( u srcu dstu buffer_sizeu fsrcu fdstu eu buf( ( u8 /opt/alt/python33/lib64/python3.3/distutils/file_util.pyu _copy_file_contents sF ,,))0 u _copy_file_contentsi c C sš d d l m } d d l m } m } m } m } t j j | ƒ sW t d | ƒ ‚ n t j j | ƒ r“ | } t j j | t j j | ƒ ƒ } n t j j | ƒ } | rä | | | ƒ rä | d k rÚ t j d | ƒ n | d f Sy t | } Wn" t k rt d | ƒ ‚ Yn X| d k ryt j j | ƒ t j j | ƒ k r`t j d | | | ƒ qyt j d | | | ƒ n | r‰| d f S| d k rÒt j j | ƒ o¹t j j | | ƒ st j | | ƒ qn¾ | d k rt j j | ƒ ot j j | | ƒ st j | | ƒ qnu t | | ƒ | s4| rt j | ƒ } | rjt j | | | | | f ƒ n | rt j | | | | ƒ ƒ qn | d f S( 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 ( u newer( u ST_ATIMEu ST_MTIMEu ST_MODEu S_IMODEu4 can't copy '%s': doesn't exist or not a regular filei u" not copying %s (output up-to-date)u&