ž ¬ÿfë˜c/@sòdZddlZddlZddlZddlmZddlZddlZddlZddl Z yddl Z [ dyZ Wne k rdzZ YnXyddlmZWne k rÌdZYnXyddlmZWne k rûdZYnXdddd d d d d dddddddddddddddgZGdd„deƒZGdd„deƒZGdd„deƒZGd d!„d!eƒZGd"d#„d#eƒZyeWnek r×dZYnXd{d&d„Zd'd(„Zd)dyd*d„Z d)dyd+d„Z!e"ed,ƒr;d)dyd-d.„Z#n d/d.„Z#d)dyd0d „Z$d)dyd1d „Z%d)dyd2d „Z&d3d„Z'dzde&dzd4d „Z(d5d6„Z)d7d8„Z*ej+ejej,ej-hej.koej/ej0koejej1kZ2dzdd9d„Z3e2e3_4d:d;„Z5d<d „Z6d=d>„Z7d?d@„Z8dAdB„Z9dCddddddDdE„Z:dzdzdFdG„Z;ddddHdI„Z<ie:d|gdKfdL6e:d}gdMfdN6e<gdOfdP6Z=e rûe:d~gdRfe=dSddUdVd„Z?dWd„Z@ddddddddXd„ZAdYd„ZBdZd[„ZCddUd\d„ZDd]d„ZEd^d_„ZFd`da„ZGdbdc„ZHidddegeHgdKfdL6dfgeHgdMfdN6dggeGgdOfdP6ZIe r dhgeHgdRfeIdS._nopcstt|ˆƒS(N(ugetattruos(uname(u_nop(u+/opt/alt/python33/lib64/python3.3/shutil.pyulookup°sucopystat..lookupcs)tt|ˆƒ}|tjkr%|SˆS(N(ugetattruosusupports_follow_symlinks(unameufn(u_nop(u+/opt/alt/python33/lib64/python3.3/shutil.pyulookupµsustatuutimeuchmodust_flagsuchflagsu EOPNOTSUPPuENOTSUPN(u EOPNOTSUPPuENOTSUP(uNoneuosupathuislinkustatuS_IMODEust_modeu st_atime_nsu st_mtime_nsuNotImplementedErroruhasattrust_flagsuOSErroruerrnougetattru _copyxattr( usrcudstufollow_symlinksufollowulookupustumodeuwhyuerr((u_nopu+/opt/alt/python33/lib64/python3.3/shutil.pyucopystat¢s,+!   'cCs`tjj|ƒr6tjj|tjj|ƒƒ}nt||d|ƒt||d|ƒ|S(uÝCopy data and mode bits ("cp src dst"). Return the file's destination. The destination may be a directory. If follow_symlinks is false, symlinks won't be followed. This resembles GNU's "cp -P src dst". ufollow_symlinks(uosupathuisdirujoinubasenameucopyfileucopymode(usrcudstufollow_symlinks((u+/opt/alt/python33/lib64/python3.3/shutil.pyucopyØs $cCs`tjj|ƒr6tjj|tjj|ƒƒ}nt||d|ƒt||d|ƒ|S(uéCopy data and all stat info ("cp -p src dst"). Return the file's destination." The destination may be a directory. If follow_symlinks is false, symlinks won't be followed. This resembles GNU's "cp -P src dst". ufollow_symlinks(uosupathuisdirujoinubasenameucopyfileucopystat(usrcudstufollow_symlinks((u+/opt/alt/python33/lib64/python3.3/shutil.pyucopy2çs $cs‡fdd†}|S(uFunction that can be used as copytree() ignore parameter. Patterns is a sequence of glob-style patterns that are used to exclude filescs:g}x'ˆD]}|jtj||ƒƒq Wt|ƒS(N(uextendufnmatchufilteruset(upathunamesu ignored_namesupattern(upatterns(u+/opt/alt/python33/lib64/python3.3/shutil.pyu_ignore_patternsüs u)ignore_patterns.._ignore_patterns((upatternsu_ignore_patterns((upatternsu+/opt/alt/python33/lib64/python3.3/shutil.pyuignore_patterns÷scCsWtj|ƒ}|dk r-|||ƒ}n tƒ}tj|ƒg}x|D]w} | |krhqPntjj|| ƒ} tjj|| ƒ} y¹tjj| ƒrtj| ƒ} |rãtj | | ƒt | | d| ƒqJtjj | ƒ r|rwPn|| | ƒn8tjj | ƒr=t | | |||ƒn || | ƒWqPtk r†} z|j| jdƒWYdd} ~ XqPtk rÆ}z!|j| | t|ƒfƒWYdd}~XqPXqPWyt ||ƒWn_tk r=}z?tdk rt|tƒrn|j||t|ƒfƒWYdd}~XnX|rSt|ƒ‚n|S(uüRecursively copy a directory tree. 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. If the file pointed by the symlink doesn't exist, an exception will be added in the list of errors raised in an Error exception at the end of the copy process. You can set the optional ignore_dangling_symlinks flag to true if you want to silence this exception. Notice that this has no effect on platforms that don't support os.symlink. The optional ignore argument is a callable. If given, it is called with the `src` parameter, which is the directory being visited by copytree(), and `names` which is the list of `src` contents, as returned by os.listdir(): callable(src, names) -> ignored_names Since copytree() is called recursively, the callable will be called once for each directory that is copied. It returns a list of names relative to the `src` directory that should not be copied. The optional copy_function argument is a callable that will be used to copy each file. It will be called with the source path and the destination path as arguments. By default, copy2() is used, but any function that supports the same signature (like copy()) can be used. ufollow_symlinksiN(uosulistdiruNoneusetumakedirsupathujoinuislinkureadlinkusymlinkucopystatuexistsuisdirucopytreeuErroruextenduargsuEnvironmentErroruappendustruOSErroru WindowsErroru isinstance(usrcudstusymlinksuignoreu copy_functionuignore_dangling_symlinksunamesu ignored_namesuerrorsunameusrcnameudstnameulinktouerruwhy((u+/opt/alt/python33/lib64/python3.3/shutil.pyucopytreesH$     &3/c$Cs¥y%tjj|ƒr$tdƒ‚nWn2tk rY|tjj|tjƒƒdSYnXg}ytj|ƒ}Wn.tjk r£|tj|tjƒƒYnXx¸|D]°}tjj||ƒ}ytj |ƒj }Wntjk rùd}YnXt j |ƒrt ||ƒq«ytj|ƒWq«tjk rZ|tj|tjƒƒYq«Xq«Wytj|ƒWn.tjk r |tj|tjƒƒYnXdS(Nu%Cannot call rmtree on a symbolic linki(uosupathuislinkuOSErrorusysuexc_infoulistdiruerrorujoinulstatust_modeustatuS_ISDIRu_rmtree_unsafeuunlinkurmdir(upathuonerrorunamesunameufullnameumode((u+/opt/alt/python33/lib64/python3.3/shutil.pyu_rmtree_unsafe[s6    "u_rmtree_unsafec 0Cs@g}ytj|ƒ}WnGtk rb}z'||_|tj|tjƒƒWYdd}~XnXxÖ|D]Î}tjj||ƒ}y(tj|d|ddƒ}|j }Wntk rÇd}YnXtj |ƒróytj |tj d|ƒ} Wn+tk r#|tj |tjƒƒYq8Xz»tjj|tj| ƒƒrt| ||ƒytj|d|ƒWqÞtk r™|tj|tjƒƒYqÞXnAytdƒ‚Wn.tk rÝ|tjj|tjƒƒYnXWdtj| ƒXqjytj|d|ƒWqjtk r7|tj|tjƒƒYqjXqjWdS(Nudir_fdufollow_symlinksiu%Cannot call rmtree on a symbolic linkF(uosulistdiruOSErrorufilenameusysuexc_infoupathujoinustatuFalseust_modeuS_ISDIRuopenuO_RDONLYusamestatufstatu_rmtree_safe_fdurmdiruislinkucloseuunlink( utopfdupathuonerrorunamesuerrunameufullnameuorig_stumodeudirfd((u+/opt/alt/python33/lib64/python3.3/shutil.pyu_rmtree_safe_fd|sD ,      ! % u_rmtree_safe_fdc!CsÄ|rdd„}n|dkr0dd„}ntr³t|tƒrWtj|ƒ}nytj|ƒ}Wn/tk r›|tj|tj ƒƒdSYnXytj |tj ƒ}Wn/tk ræ|tj|tj ƒƒdSYnXz¸tj j |tj|ƒƒr]t|||ƒytj|ƒWqžtjk rY|tj|tj ƒƒYqžXnAytdƒ‚Wn.tk r|tj j|tj ƒƒYnXWdtj|ƒXn t||ƒSdS(uÄ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 with arguments (func, path, exc_info) where func is platform and implementation dependent; path is the argument to that function that caused it to fail; and exc_info is a tuple returned by sys.exc_info(). If ignore_errors is false and onerror is None, an exception is raised. cWsdS(N((uargs((u+/opt/alt/python33/lib64/python3.3/shutil.pyuonerror¹surmtree..onerrorcWs‚dS(N((uargs((u+/opt/alt/python33/lib64/python3.3/shutil.pyuonerror¼sNu%Cannot call rmtree on a symbolic link(uNoneu_use_fd_functionsu isinstanceubytesuosufsdecodeulstatu Exceptionusysuexc_infouopenuO_RDONLYupathusamestatufstatu_rmtree_safe_fdurmdiruerroruOSErroruislinkucloseu_rmtree_unsafe(upathu ignore_errorsuonerroruorig_stufd((u+/opt/alt/python33/lib64/python3.3/shutil.pyurmtree­s<      ! %cCs5tjjtjjpd}tjj|j|ƒƒS(Nu(uosupathusepualtsepubasenameurstrip(upathusep((u+/opt/alt/python33/lib64/python3.3/shutil.pyu _basenameäsu _basenamec Cs`|}tjj|ƒr~t||ƒr;tj||ƒdStjj|t|ƒƒ}tjj|ƒr~td|ƒ‚q~nytj||ƒWnÇt k r[tjj |ƒrãtj |ƒ}tj ||ƒtj |ƒnttjj|ƒr=t||ƒrtd||fƒ‚nt||ddƒt|ƒnt||ƒtj |ƒYnX|S(u0Recursively move a file or directory to another location. This is similar to the Unix "mv" command. Return the file or directory's destination. If the destination is a directory or a symlink to a directory, the source is moved inside the directory. The destination path must not already exist. If the destination already exists but is not a directory, it may be overwritten depending on os.rename() semantics. If the destination is on our current filesystem, then rename() is used. Otherwise, src is copied to the destination and then removed. Symlinks are recreated under the new name if os.rename() fails because of cross filesystem renames. A lot more could be done here... A look at a mv.c shows a lot of the issues this implementation glosses over. Nu$Destination path '%s' already existsu.Cannot move a directory '%s' into itself '%s'.usymlinksT(uosupathuisdiru _samefileurenameujoinu _basenameuexistsuErroruOSErroruislinkureadlinkusymlinkuunlinku _destinsrcucopytreeuTrueurmtreeucopy2(usrcudstureal_dstulinkto((u+/opt/alt/python33/lib64/python3.3/shutil.pyumoveês.   cCsut|ƒ}t|ƒ}|jtjjƒs@|tjj7}n|jtjjƒsh|tjj7}n|j|ƒS(N(uabspathuendswithuosupathusepu startswith(usrcudst((u+/opt/alt/python33/lib64/python3.3/shutil.pyu _destinsrcs  u _destinsrcc Cs_tdks|dkrdSyt|ƒ}Wntk rFd}YnX|dk r[|dSdS(u"Returns a gid, given a group name.iN(ugetgrnamuNoneuKeyError(unameuresult((u+/opt/alt/python33/lib64/python3.3/shutil.pyu_get_gid$s   u_get_gidc Cs_tdks|dkrdSyt|ƒ}Wntk rFd}YnX|dk r[|dSdS(u"Returns an uid, given a user name.iN(ugetpwnamuNoneuKeyError(unameuresult((u+/opt/alt/python33/lib64/python3.3/shutil.pyu_get_uid0s   u_get_uidugzipc sidd6dd6}idd6} tr>d|d._set_uid_giduw|%sufilterN(uNoneu_BZ2_SUPPORTEDu ValueErroruformatugetuosupathudirnameuexistsuinfoumakedirsu_get_uidu_get_gidutarfileuopenuadduclose(u base_nameubase_dirucompressuverboseudry_runuownerugroupuloggerutar_compressionu compress_extu archive_nameu archive_diru _set_uid_gidutar((ugidugroupuowneruuidu+/opt/alt/python33/lib64/python3.3/shutil.pyu _make_tarball<s4         u _make_tarballc Cs~|rd}nd}ddlm}ddlm}y |d|||gd|ƒWn"|k rytdƒ|‚YnXdS( Nu-ru-rqi(uDistutilsExecError(uspawnuzipudry_runukunable to create zip file '%s': could neither import the 'zipfile' module nor find a standalone zip utility(udistutils.errorsuDistutilsExecErrorudistutils.spawnuspawnu ExecError(ubase_diru zip_filenameuverboseudry_runu zipoptionsuDistutilsExecErroruspawn((u+/opt/alt/python33/lib64/python3.3/shutil.pyu_call_external_zipzs    u_call_external_zipcCsŸ|d}tjj|ƒ}tjj|ƒsf|dk rM|jd|ƒn|sftj|ƒqfnyddl}Wntk rd}YnX|dkr³t ||||ƒnè|dk rÕ|jd||ƒn|s›|j |dd|j ƒ }x–tj |ƒD]…\} } } xs| D]k} tjj tjj| | ƒƒ} tjj| ƒr|j| | ƒ|dk rŠ|jd| ƒqŠqqWq WWdQXn|S( umCreate a zip file from all the files under 'base_dir'. The output zip file will be named 'base_name' + ".zip". Uses either the "zipfile" Python module (if available) or the InfoZIP "zip" utility (if installed and found on the default search path). If neither tool is available, raises ExecError. Returns the name of the output zip file. u.zipu creating %siNu#creating '%s' and adding '%s' to ituwu compressionu adding '%s'(uosupathudirnameuexistsuNoneuinfoumakedirsuzipfileu ImportErroru_call_external_zipuZipFileu ZIP_DEFLATEDuwalkunormpathujoinuisfileuwrite(u base_nameubase_diruverboseudry_runuloggeru zip_filenameu archive_diruzipfileuzfudirpathudirnamesu filenamesunameupath((u+/opt/alt/python33/lib64/python3.3/shutil.pyu _make_zipfile‹s6         ! 'u _make_zipfileucompressugzip'ed tar-fileugztaruuncompressed tar fileutaruZIP fileuzipubzip2ubzip2'ed tar-fileubztarcCs'dd„tjƒDƒ}|jƒ|S(u‘Returns a list of supported formats for archiving and unarchiving. Each element of the returned sequence is a tuple (name, description) cSs&g|]\}}||df‘qS(i((u.0unameuregistry((u+/opt/alt/python33/lib64/python3.3/shutil.pyu Çs u'get_archive_formats..(u_ARCHIVE_FORMATSuitemsusort(uformats((u+/opt/alt/python33/lib64/python3.3/shutil.pyuget_archive_formatsÂs  ucCs·|dkrg}nt|ƒs4td|ƒ‚nt|ttfƒsXtdƒ‚nxE|D]=}t|ttfƒ st|ƒdkr_tdƒ‚q_q_W|||ft|!s u&get_unpack_formats..(u_UNPACK_FORMATSuitemsusort(uformats((u+/opt/alt/python33/lib64/python3.3/shutil.pyuget_unpack_formatss  c Cs¡i}x9tjƒD]+\}}x|dD]}|||._access_checkuPATHuwin32iuPATHEXTuc3s*|] }ˆjƒj|jƒƒVqdS(N(uloweruendswith(u.0uext(ucmd(u+/opt/alt/python33/lib64/python3.3/shutil.pyu Vsuwhich..csg|]}ˆ|‘qS(((u.0uext(ucmd(u+/opt/alt/python33/lib64/python3.3/shutil.pyu Ys uwhich..N(uosupathudirnameuNoneuenvironugetudefpathusplitupathsepusysuplatformucurdiruinsertuanyusetunormcaseuaddujoin( ucmdumodeupathu _access_checkupathextufilesuseenudirunormdiruthefileuname((ucmdu+/opt/alt/python33/lib64/python3.3/shutil.pyuwhich,s8  !       TFi@(ucompressugzip(ucompressN(ucompressubzip2(iPi(Wu__doc__uosusysustatuos.pathuabspathufnmatchu collectionsuerrnoutarfileubz2uTrueu_BZ2_SUPPORTEDu ImportErroruFalseupwdugetpwnamuNoneugrpugetgrnamu__all__uEnvironmentErroruErroruSpecialFileErroru ExecErroru ReadErroru Exceptionu RegistryErroru WindowsErroru NameErroru copyfileobju _samefileucopyfileucopymodeuhasattru _copyxattrucopystatucopyucopy2uignore_patternsucopytreeu_rmtree_unsafeu_rmtree_safe_fduopenuunlinkurmdirusupports_dir_fdulistdiru supports_fdusupports_follow_symlinksu_use_fd_functionsurmtreeuavoids_symlink_attacksu _basenameumoveu _destinsrcu_get_gidu_get_uidu _make_tarballu_call_external_zipu _make_zipfileu_ARCHIVE_FORMATSuget_archive_formatsuregister_archive_formatuunregister_archive_formatu make_archiveuget_unpack_formatsu_check_unpack_optionsuregister_unpack_formatuunregister_unpack_formatu_ensure_directoryu_unpack_zipfileu_unpack_tarfileu_UNPACK_FORMATSu_find_unpack_formatuunpack_archiveuappendu namedtupleu_ntuple_diskusageu disk_usageunameuntuchownuget_terminal_sizeuF_OKuX_OKuwhich(((u+/opt/alt/python33/lib64/python3.3/shutil.pyusÚ                    6 W ! , 5   1 =-    6    %   %     +