|yMac@sdZddlZddlZddlmZmZddlmZiadddddZ dddd d Z ddddddd d Z d dZ ddddZ ddZdS(uWdistutils.dir_util Utility functions for manipulating directories and directory trees.iN(uDistutilsFileErroruDistutilsInternalError(ulogiic Cst|ts%td|fntjj|}g}tjj|s[|dkr_|Stjtjj |r~|Stjj |\}}|g}xK|r|rtjj| rtjj |\}}|j d|qWx |D]}tjj ||}tjj |} tj| r6qn|dkrUt jd|n|sytj||Wnitk r} zI| jtjkotjj|std|| jdfnWYdd} ~ XnX|j|ndt|  "  $0umkpathcCsvt}x6|D].}|jtjj|tjj|qWx-t|D]}t||d|d|qOWdS(uCreate all the empty directories under 'base_dir' needed to put 'files' there. 'base_dir' is just the a 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()'. uverboseudry_runN(usetuadduosupathujoinudirnameusortedumkpath(ubase_dirufilesumodeuverboseudry_rununeed_dirufileudir((u7/opt/alt/python33/lib64/python3.3/distutils/dir_util.pyu create_treePs  ,u create_treecCsddlm}| r=tjj| r=td|nytj|} WnYtjk r} z6| \} } |rg} ntd|| fWYdd} ~ XnX|st|d|ng} x1| D])}tjj ||}tjj ||}|j drqn|rtjj |rtj |}|dkr`t jd ||n|sytj||n| j|qtjj|r| jt||||||d|d |q||||||d|d || j|qW| S( uCopy 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(u copy_fileu&cannot copy tree '%s': not a directoryuerror listing files in '%s': %sNuverboseu.nfsiulinking %s -> %sudry_run(udistutils.file_utilu copy_fileuosupathuisdiruDistutilsFileErrorulistdiruerrorumkpathujoinu startswithuislinkureadlinkuloguinfousymlinkuappenduextendu copy_tree(usrcudstu preserve_modeupreserve_timesupreserve_symlinksuupdateuverboseudry_runu copy_fileunamesueuerrnouerrstruoutputsunusrc_nameudst_nameu link_dest((u7/opt/alt/python33/lib64/python3.3/distutils/dir_util.pyu copy_treecsJ  &     u copy_treecCsxwtj|D]f}tjj||}tjj|r`tjj| r`t||q|jtj|fqW|jtj |fdS(uHelper for remove_tree().N( uosulistdirupathujoinuisdiruislinku_build_cmdtupleuappenduremoveurmdir(upathu cmdtuplesufureal_f((u7/opt/alt/python33/lib64/python3.3/distutils/dir_util.pyu_build_cmdtuples %u_build_cmdtuplecCs|dkrtjd|n|r)dSg}t||x|D]}yB|d|dtjj|d}|tkrt|=nWqCttfk r}ztj d||WYdd}~XqCXqCWdS(uRecursively remove an entire directory tree. Any errors are ignored (apart from being reported to stdout if 'verbose' is true). iu'removing '%s' (and everything under it)Niuerror removing %s: %s( uloguinfou_build_cmdtupleuosupathuabspathu _path_createduIOErroruOSErroruwarn(u directoryuverboseudry_runu cmdtuplesucmduabspathuexc((u7/opt/alt/python33/lib64/python3.3/distutils/dir_util.pyu remove_trees    u remove_treecCsLtjj|\}}|ddtjkrH||dd}n|S(uTake the full path 'path', and make it a relative path. This is useful to make 'path' the second argument to os.path.join(). iiN(uosupathu splitdriveusep(upathudrive((u7/opt/alt/python33/lib64/python3.3/distutils/dir_util.pyuensure_relativesuensure_relative(u__doc__uosuerrnoudistutils.errorsuDistutilsFileErroruDistutilsInternalErroru distutilsulogu _path_createdumkpathu create_treeu copy_treeu_build_cmdtupleu remove_treeuensure_relative(((u7/opt/alt/python33/lib64/python3.3/distutils/dir_util.pyus  ?E