ó RÑÕfc@s´ddlZddlZddlZddlTddlZejjZeZej jZ da d„Z ejdƒZd„Zd„Zd„Zd„Zed kr°e ƒndS( iÿÿÿÿN(t*cCspdtjd}y#tjtjddƒ\}}Wn;tjk rq}t|dƒt|ƒtjdƒnXx)|D]!\}}|dkry|aqyqyWt s¼tddks¼| ràtd ƒt|ƒtjdƒnd}xv|D]n}tjj |ƒrt |ƒr[d}q[qítjj |ƒrFt|d ƒd}qít |ƒríd}qíqíWtj|ƒdS( Ns0usage: %s -i /interpreter file-or-directory ... iisi:s is-it/s'-i option or file-or-directory missing s": will not process symbolic links ( tsystargvtgetoptterrorterrtexittnew_interpretertostpathtisdirt recursedowntislinktfix(tusagetoptstargstmsgtotatbadtarg((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pytmain"s4#         s^[a-zA-Z0-9_]+\.py$cCstj|ƒdkS(Ni(t ispythonprogtmatch(tname((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pytispython?scCs1td|fƒd}ytj|ƒ}Wn+tjk rW}td||fƒdSX|jƒg}xœ|D]”}|tjtjfkr“qontjj ||ƒ}tjj |ƒr½qotjj |ƒrß|j |ƒqot |ƒrot|ƒrd}qqoqoWx#|D]}t|ƒrd}qqW|S(Nsrecursedown(%r) is%s: cannot list directory: %r i(tdbgR tlistdirRRtsorttcurdirtpardirR tjoinR R tappendRRR (tdirnameRtnamesRtsubdirsRtfullname((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyR Bs0      c Cs;yt|dƒ}Wn(tk r=}td||fƒdSX|jƒ}t|ƒ}||kr~t|dƒ|jƒdStjj |ƒ\}}tjj |d|ƒ}yt|dƒ}Wn2tk rö}|jƒtd||fƒdSXt|dƒ|j |ƒd} x)|j | ƒ} | s4Pn|j | ƒq|jƒ|jƒy+tj |ƒ} tj|| td @ƒWn*tjk r¯}td ||fƒnXytj||d ƒWn*tjk rô}td||fƒnXytj||ƒWn+tjk r6}td||fƒdSXdS(Ntrs%s: cannot open: %r is : no change t@tws%s: cannot create: %r s : updating iiiÿs%s: warning: chmod failed (%r) t~s %s: warning: backup failed (%r) s%s: rename failed (%r) ii (topentIOErrorRtreadlinetfixlinetreptcloseR R tsplitR!twritetreadtstattchmodtST_MODERtrename( tfilenametfRtlinetfixedtheadttailttempnametgtBUFSIZEtbuftstatbuf((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyRXsX        cCs+|jdƒs|Sd|kr#|SdtS(Ns#!tpythons#! %s (t startswithR(R:((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyR.s  t__main__(RtreR R4RtstderrR2RRtstdoutR/tNoneRRtcompileRRR RR.t__name__(((s-/usr/lib64/python2.7/Tools/scripts/pathfix.pyts           5