ó fc@sÌddlZddlZddlZddlTejjZeZejjZ d„Z ej dƒZ d„Z d„Zd„ZdZej eƒZd Zej eƒZd „Zed krÈe ƒndS( iÿÿÿÿN(t*cCsÍd}tjds<tdtjddƒtjdƒnx}tjdD]n}tjj|ƒrzt|ƒr¸d}q¸qJtjj|ƒr£t|dƒd}qJt |ƒrJd}qJqJWtj|ƒdS(Niisusage: s file-or-directory ... is": will not process symbolic links ( tsystargvterrtexittostpathtisdirt recursedowntislinktfix(tbadtarg((s./usr/lib64/python2.7/Tools/scripts/classfix.pytmain)s    s^[a-zA-Z0-9_]+\.py$cCstj|ƒdkS(Ni(t ispythonprogtmatch(tname((s./usr/lib64/python2.7/Tools/scripts/classfix.pytispython9scCs1td|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(tdbgRtlistdirterrorRtsorttcurdirtpardirRtjoinR RtappendRR R(tdirnameR tnamestmsgtsubdirsRtfullname((s./usr/lib64/python2.7/Tools/scripts/classfix.pyR<s0      c Cs¼yt|dƒ}Wn(tk r=}td||fƒdSXtjj|ƒ\}}tjj|d|ƒ}d}d}xG|jƒ}|s”Pn|d}x>|ddkrÞ|jƒ} | sÇPn|| }|d}q¡Wt |ƒ} | |kr¥|dkrryt|dƒ}Wn2tk rJ}|j ƒtd ||fƒdSX|j dƒd}t |d ƒq~nt t |ƒd ƒt d |ƒt d | ƒn|dk r~|j| ƒq~q~W|j ƒ|sÙdSy+tj|ƒ} tj|| td@ƒWn*tjk r0}td||fƒnXytj||dƒWn*tjk ru}td||fƒnXytj||ƒWn+tjk r·}td||fƒdSXdS(Ntrs%s: cannot open: %r it@iiþÿÿÿs\ tws%s: cannot create: %r s: s s< s> iÿs%s: warning: chmod failed (%r) t~s %s: warning: backup failed (%r) s%s: rename failed (%r) (topentIOErrorRRRtsplitRtNonetreadlinetfixlinetclosetseektreptreprtwritetstattchmodtST_MODERtrename( tfilenametfRtheadttailttempnametgtlinenotlinetnextlinetnewlinetstatbuf((s./usr/lib64/python2.7/Tools/scripts/classfix.pyR Rsp           s-^([ ]*class +[a-zA-Z0-9_]+) *( *) *((=.*)?):s^ *(.*) *( *) *$cCstj|ƒdkr|Stjd \\}}\}}\}}|| }||}||krm|d|S||d|!} | jdƒ} x^tt| ƒƒD]J} tj| | ƒdkr tjd\} } | | | | !| | s$          E