mò %U²Ic#@s¥dZdkZdkZdddddddd d d d d ddddddddddddddddddd d!d"d#d$g#Zd%Zd&Zd%Zd'Zd(Zd)Z d*Z d+Z d,„Z d-„Z d.„Zd/„Zd0„Zd1„Zd2„Zd3„Zd4„Zd5„Zd6„Zd7„Zd8„Zd9„Zd:„Zd;„ZeZd<„Zd=„Zd>„Zd?„Z d@„Z!dA„Z"dB„Z#dC„Z$e$Z%e&Z'dS(DsŒCommon pathname manipulations, OS/2 EMX version. Instead of importing this module directly, import os and refer to this module as os.path. Ntnormcasetisabstjoint splitdrivetsplittsplitexttbasenametdirnamet commonprefixtgetsizetgetmtimetgetatimetgetctimetislinktexiststlexiststisdirtisfiletismounttwalkt expandusert expandvarstnormpathtabspathtsplitunctcurdirtpardirtseptpathseptdefpathtaltseptextseptdevnulltrealpathtsupports_unicode_filenamest.s..t/s\t;s.;C:\bintnulcCs|iddƒiƒS(sZNormalize case of pathname. Makes all characters lowercase and all altseps into seps.s\R$N(tstreplacetlower(R'((t'/data/zmath/lib/python2.4/os2emxpath.pyR scCs+t|ƒd}|djo|d djS(sTest whether a path is absoluteits/\N(RR'(R'((R*R-scGsl|}x_|D]W}t|ƒo |}q |djp|ddjo||}q |d|}q W|S(s=Join two or more pathname components, inserting sep as neededR+iÿÿÿÿs/\:R$N(tatpathtptbR(R,R.R/R-((R*R5s  cCs7|dd!djo|dd!|dfSnd|fS(slSplit a pathname into drive and path specifiers. Returns a 2-tuple "(drive,path)"; either part may be emptyiit:iR+N(R.(R.((R*REscCsÝ|dd!djod|fSn|dd!}|ddjp|ddjo‚t|ƒ}|iddƒ}|djod|fSn|id|dƒ}|djot|ƒ}n|| ||fSnd|fS( s@Split a pathname into UNC mount point and relative path specifiers. Return a 2-tuple (unc, rest); either part may be empty. If unc is not empty, it has the form '//host/mount' (or similar using backslashes). unc+rest is always the input path. Paths containing drive letters never have an UNC part. iiR0R+iR$s\iÿÿÿÿN(R.tfirstTwoRtnormptfindtindextlen(R.R4R1R2((R*RNs "   cCs¬t|ƒ\}}t|ƒ}x+|o#||ddjo|d}q!W|| ||}}|}x'|o|ddjo|d }qjW|p|}|||fS(s~Split a pathname. Return tuple (head, tail) where tail is everything after the final slash. Either part may be empty.is/\iÿÿÿÿN(RR.tdR5titheadttailthead2(R.R8R6R7R9R:((R*Ros  cCs¥d\}}xŒ|D]„}|ddgjo|||d}}q|djo&|o|||}}q—|}q|o||}q||}qW||fS(s‘Split the extension from a pathname. Extension is everything from the last dot to the end. Return (root, ext), either part may be empty.R+R$s\R#N(R+R+(troottextR.tc(R.R<R;R=((R*Rˆs   cCst|ƒdS(s)Returns the final component of a pathnameiN(RR.(R.((R*RŸscCst|ƒdS(s-Returns the directory component of a pathnameiN(RR.(R.((R*R¦scCsŒ|pdSn|d}xl|D]d}x[tt|ƒƒD]G}||d ||d jo$|| }|djodSnPq9q9Wq W|S(sGGiven a list of pathnames, returns the longest common leading componentR+iiN(tmtprefixtitemtrangeR5R7(R>R7R@R?((R*R­s    cCsti|ƒiS(s0Return the size of a file, reported by os.stat()N(toststattfilenametst_size(RD((R*R ¼scCsti|ƒiS(sBReturn the last modification time of a file, reported by os.stat()N(RBRCRDtst_mtime(RD((R*R ÀscCsti|ƒiS(s<Return the last access time of a file, reported by os.stat()N(RBRCRDtst_atime(RD((R*R ÄscCsti|ƒiS(s:Return the creation time of a file, reported by os.stat().N(RBRCRDtst_ctime(RD((R*R ÈscCstS(s5Test for symbolic link. On OS/2 always returns falseN(tFalse(R-((R*R ÏscCs4yti|ƒ}Wntij o tSnXtS(sTest whether a path existsN(RBRCR-tstterrorRItTrue(R-RJ((R*R×s  cCs@yti|ƒ}Wntij o tSnXti|iƒS(s"Test whether a path is a directoryN(RBRCR-RJRKRItS_ISDIRtst_mode(R-RJ((R*Räs  cCs@yti|ƒ}Wntij o tSnXti|iƒS(s%Test whether a path is a regular fileN(RBRCR-RJRKRItS_ISREGRN(R-RJ((R*Rñs  cCsXt|ƒ\}}|o|djSnt|ƒd}t|ƒdjo|ddjS( s?Test whether a path is a mount point (defined as root of drive)R+R$s\iis/\N(R+R$s\(RR-tunctrestRR.R5(R-RQR.RP((R*Rýs cCsœyti|ƒ}Wntij o dSnX||||ƒd}xO|D]G}||jo4t ||ƒ}t |ƒot |||ƒq”qMqMWdS(sëDirectory tree walk whth callback function. walk(top, func, arg) calls func(arg, d, files) for each directory d in the tree rooted at top (including top itself); files is a list of all the files and subdirs in directory d.NR#s..(R#s..( RBtlistdirttoptnamesRKtfunctargt exceptionstnameRRR(RSRURVRXRTRW((R*Rs   cCsù|d djo|Sndt|ƒ}}x-||jo||djo|d}q/W|djo€dtijotid}qídtijo|Sqíytid}Wntj o d}nXt |tidƒ}n|S|||S( sLExpand ~ and ~user constructs. If user or $HOME is unknown, do nothing.it~s/\tHOMEtHOMEPATHt HOMEDRIVER+N( R-R5R7tnRBtenvirontuserhometdrivetKeyErrorR(R-R7R`R]R_((R*R*s&  cCs’d|jo|Sndk}|i|id}d}d}t|ƒ}xA||jo3||}|djoq||d}t|ƒ}y)|idƒ}|d||d }Wqt j o||}|d}qXnž|djo†||d|d!djo||}|d}q||d|d!d joŠ||d}t|ƒ}yB|id ƒ}|| }|t i jo|t i |}nWqqt j o||}|d}qqXqd}|d}|||d!}xD|djo6||jo)||}|d}|||d!}qíW|t i jo|t i |}n|djo||}qn ||}|d}qMW|S( sZExpand shell variables of form $var and ${var}. Unknown variables are left unchanged.t$Ns_-R+is'iit{t}(R-tstringtletterstdigitstvarcharstresR4R5tpathlenR=t ValueErrortvarRBR^(R-R4R=ReRiRhRjRl((R*RLsd                  cCsj|iddƒ}t|ƒ\}}x*|d djo|d}|d}q'W|idƒ}d}xÏ|t|ƒjo»||djo ||=qi||djoB|djo5||dd jo ||d|d5|d}qi||djo-|djo ||ddjo ||=qi|d}qiW| o| o|idƒn|di |ƒS( s0Normalize path, eliminating double slashes, etc.s\R$iiR#s..R+N(R+s..( R-R(RR?RtcompsR7R5tappendR(R-R7RmR?((R*R…s,  33 cCs0t|ƒpttiƒ|ƒ}nt|ƒS(s%Return the absolute version of a pathN(RR-RRBtgetcwdR(R-((R*RŸs ((t__doc__RBRCt__all__RRRRRRRR RRRRRRRRRRR R R R R RRRRRRRRRRR!RIR"(&RRRRRRRRRR RRRR"RqRRR RR R RR!RCRRRR RRRR RRRRRRB((R*t?sL  o   !              " 9