Ñò §ÚêLc+@sÐdZddkZddkZddkZddkZddkTdddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)g&Zd*Zd+Zd*Zd,Z d-Z d.Z dZ d/Zd0„Zd1„Zd2„Zd3„Zd4„Zeiie_d5„Zd6„Zd7„Zd8„Zd9„Zd:„Zd;„Zd<„Zd=„Zd>„Zd?„Zda d@„Z!dA„Z"dB„Z#dC„Z$dD„Z%e&Z'edE„Z(dS(FsçCommon operations on Posix pathnames. Instead of importing this module directly, import os and refer to this module as os.path. The "os.path" name is an alias for this module on Posix systems; on other systems (e.g. Mac, Windows), os.path provides the same operations in a manner specific to that platform, and is an alias to another module (e.g. macpath, ntpath). Some of this can actually be useful on non-Posix systems too, e.g. for manipulation of the pathname component of URLs. iÿÿÿÿN(t*tnormcasetisabstjoint splitdrivetsplittsplitexttbasenametdirnamet commonprefixtgetsizetgetmtimetgetatimetgetctimetislinktexiststlexiststisdirtisfiletismounttwalkt expandusert expandvarstnormpathtabspathtsamefilet sameopenfiletsamestattcurdirtpardirtseptpathseptdefpathtaltseptextseptdevnulltrealpathtsupports_unicode_filenamestrelpatht.s..t/t:s:/bin:/usr/bins /dev/nullcCs|S(s6Normalize case of pathname. Has no effect under Posix((ts((s!/usr/lib64/python2.6/posixpath.pyR*scCs |idƒS(sTest whether a path is absoluteR((t startswith(R*((s!/usr/lib64/python2.6/posixpath.pyR2scGsn|}xa|D]Y}|idƒo |}q |djp|idƒo||7}q |d|7}q W|S(sœJoin two or more pathname components, inserting '/' as needed. If any component is an absolute path, all previous path components will be discarded.R(t(R+tendswith(tatptpathtb((s!/usr/lib64/python2.6/posixpath.pyR;s cCsc|idƒd}|| ||}}|o*|dt|ƒjo|idƒ}n||fS(s€Split a pathname. Returns tuple "(head, tail)" where "tail" is everything after the final slash. Either part may be empty.R(i(trfindtlentrstrip(R/titheadttail((s!/usr/lib64/python2.6/posixpath.pyROs cCsti|tttƒS(N(t genericpatht _splitextRR!R"(R/((s!/usr/lib64/python2.6/posixpath.pyR^scCs d|fS(sJSplit a pathname into drive and path. On Posix, drive is always empty.R,((R/((s!/usr/lib64/python2.6/posixpath.pyRescCs|idƒd}||S(s)Returns the final component of a pathnameR(i(R2(R/R5((s!/usr/lib64/python2.6/posixpath.pyRmscCsR|idƒd}|| }|o*|dt|ƒjo|idƒ}n|S(s-Returns the directory component of a pathnameR(i(R2R3R4(R/R5R6((s!/usr/lib64/python2.6/posixpath.pyRus  cCsCyti|ƒ}Wntitfj otSXti|iƒS(s&Test whether a path is a symbolic link(tostlstatterrortAttributeErrortFalsetstattS_ISLNKtst_mode(R0tst((s!/usr/lib64/python2.6/posixpath.pyRs cCs1yti|ƒ}Wntij otSXtS(sCTest whether a path exists. Returns True for broken symbolic links(R:R;R<R>tTrue(R0RB((s!/usr/lib64/python2.6/posixpath.pyR‹s cCs+ti|ƒ}ti|ƒ}t||ƒS(s9Test whether two pathnames reference the same actual file(R:R?R(tf1tf2ts1ts2((s!/usr/lib64/python2.6/posixpath.pyR–scCs+ti|ƒ}ti|ƒ}t||ƒS(s:Test whether two open file objects reference the same file(R:tfstatR(tfp1tfp2RFRG((s!/usr/lib64/python2.6/posixpath.pyR scCs#|i|ijo|i|ijS(s5Test whether two stat buffers reference the same file(tst_inotst_dev(RFRG((s!/usr/lib64/python2.6/posixpath.pyRªscCs£t|ƒotSy+ti|ƒ}tit|dƒƒ}Wntij otSX|i}|i}||jotS|i}|i}||jotStS(s$Test whether a path is a mount points..( RR>R:R;RR<RLRCRK(R0RFRGtdev1tdev2tino1tino2((s!/usr/lib64/python2.6/posixpath.pyR³s        c CsÊtidddƒyti|ƒ}Wntij odSX||||ƒxs|D]k}t||ƒ}yti|ƒ}Wntij o qWnXti|i ƒot |||ƒqWqWWdS(sIDirectory tree walk with callback function. For each directory in the directory tree rooted at top (including top itself, but excluding '.' and '..'), call func(arg, dirname, fnames). dirname is the name of the directory, and fnames a list of the names of the files and subdirectories in dirname (excluding '.' and '..'). func may modify the fnames list in-place (e.g. via del or slice assignment), and walk will only recurse into the subdirectories whose names remain in fnames; this can be used to implement a filter, or to impose a specific order of visiting. No semantics are defined for, or required of, arg, beyond that arg is always passed to func. It can be used, e.g., to pass a filename pattern, or a mutable object designed to accumulate statistics. Passing None for arg is common.s4In 3.x, os.path.walk is removed in favor of os.walk.t stackleveliN( twarningstwarnpy3kR:tlistdirR<RR;R?tS_ISDIRRAR(ttoptfunctargtnamestnameRB((s!/usr/lib64/python2.6/posixpath.pyRÐs  cCs|idƒp|S|iddƒ}|djot|ƒ}n|djoIdtijo(ddk}|itiƒƒi}qàtid}nGddk}y|i |d|!ƒ}Wnt j o|SX|i}|i dƒp|}|||S(sOExpand ~ and ~user constructions. If user or $HOME is unknown, do nothing.t~R(iitHOMEiÿÿÿÿN( R+tfindR3R:tenvirontpwdtgetpwuidtgetuidtpw_dirtgetpwnamtKeyErrorR4(R0R5R_tuserhometpwent((s!/usr/lib64/python2.6/posixpath.pyRøs$     cCsd|jo|Stpddk}|idƒand}xÎtoÆti||ƒ}|pPn|idƒ\}}|idƒ}|idƒo!|idƒo|dd!}n|t i jo9||}|| t i |}t |ƒ}||7}qA|}qAW|S( sZExpand shell variables of form $var and ${var}. Unknown variables are left unchanged.t$iÿÿÿÿNs\$(\w+|\{[^}]*\})iit{t}( t_varprogtretcompileRCtsearchtspantgroupR+R-R:R^R3(R0RkR5tmtjRZR7((s!/usr/lib64/python2.6/posixpath.pyRs,      cCsDt|tƒod nd \}}|djo|S|idƒ}|o+|idƒo|idƒ o d}n|idƒ}g}x}|D]u}|d joq’n|d jp(| o| p|o"|d d jo|i|ƒq’|o|iƒq’q’W|}|i|ƒ}|o|||}n|p|S(s0Normalize path, eliminating double slashes, etc.u/u.R(R'R,s//s///is..iÿÿÿÿ(u/u.(R(R'(R,R'(t isinstancetunicodeR+RtappendtpopR(R0tslashtdottinitial_slashestcompst new_compstcomp((s!/usr/lib64/python2.6/posixpath.pyR7s.# !  cCsVt|ƒp?t|tƒotiƒ}n tiƒ}t||ƒ}nt|ƒS(sReturn an absolute path.(RRrRsR:tgetcwdutgetcwdRR(R0tcwd((s!/usr/lib64/python2.6/posixpath.pyRTs   cCsét|ƒodg|idƒd}ndg|idƒ}x›tdt|ƒdƒD]€}t|d|!Œ}t|ƒoZt|ƒ}|djott|g||ŒƒSt|g||Œ}t |ƒSq[q[Wt|ƒS(slReturn the canonical path of the specified filename, eliminating any symbolic links encountered in the path.R(iR,iiN( RRtrangeR3RRt _resolve_linktNoneRR$(tfilenametbitsR5t componenttresolvedtnewpath((s!/usr/lib64/python2.6/posixpath.pyR$bs    cCs‹g}x~t|ƒop||jodS|i|ƒti|ƒ}t|ƒp%t|ƒ}tt||ƒƒ}q t|ƒ}q W|S(sÈInternal helper function. Takes a path and follows symlinks until we either arrive at something that isn't a symlink, or encounter a path we've seen before (meaning that there's a loop). N( RRRtR:treadlinkRRRR(R0t paths_seenR…tdir((s!/usr/lib64/python2.6/posixpath.pyR€ys     cCsŽ|ptdƒ‚nt|ƒitƒ}t|ƒitƒ}tt||gƒƒ}tgt|ƒ|||}|ptSt|ŒS(s#Return a relative version of a pathsno path specified( t ValueErrorRRRR3R RRR(R0tstartt start_listt path_listR5trel_list((s!/usr/lib64/python2.6/posixpath.pyR&s()t__doc__R:R?R8RRt__all__RRR"RRR RR!R#RRRRRR9RRRRRRRRRRRRjRRRR$R€R>R%R&(((s!/usr/lib64/python2.6/posixpath.pyt sZ              (