V Qc@sdZddlZddlZddlZddlZddlZddlTddlZddlZdZej ej fZ dd dYZ de ej fdYZd ejfd YZd Zed krendS(sFile System Proxy. Provide an OS-neutral view on a file system, locally or remotely. The functionality is geared towards implementing some sort of rdist-like utility between a Mac and a UNIX system. The module defines three classes: FSProxyLocal -- used for local access FSProxyServer -- used on the server side of remote access FSProxyClient -- used on the client side of remote access The remote classes are instantiated with an IP address and an optional verbosity flag. iN(t*it FSProxyLocalcBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d+d Zd+d Zd+d Zd+dZdZdZdZdZdZdZdZdZdZdZd+dZd+dZd+dZd+dZd+dZ dZ!d+dZ"d+d Z#d+d!Z$d+d"Z%d+d#Z&d$d%d&Z'd'Z(d$d(Z)d)Z*d*Z+RS(,cCs#g|_dg|j|_dS(Ns*.pyc(t _dirstackt _readignoret_ignore(tself((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt__init__!s cCsx|jr|jqWdS(N(Rtback(R((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt_close%s cCs|jd}yt|}WnEtk rf|jd}yt|}Wqgtk rbgSXnXg}xC|j}|sPn|ddkr|d }n|j|qp|j|S(Ntignoressynctree.ignorefilesis (t_hidetopentIOErrortreadlinetappendtclose(RtfiletfR tline((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyR)s&      cCs|ddkS(Nit.((Rtname((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt_hidden<scCsd|S(Ns.%s((RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyR ?scCst|tkrdS|ddkr*dS|tkr:dS|j|rMdStjj|\}}|sr| rvdStjj|rdSdt|dj dkrdSx'|j D]}t j ||rdSqWdS(Niit~ttrbii( tlent maxnamelent skipnamesRtostpathtsplittislinkR treadRtfnmatch(RRtheadttailtign((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytvisibleBs&  cCs,|j|s(tjdt|ndS(Nsprotected name %s(R%Rterrortrepr(RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytcheckOscCs<|j|tjj|s8tjdt|ndS(Nsnot a plain file %s(R(RRtisfileR&R'(RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt checkfileSs cCs tjS(N(Rtgetcwd(R((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytpwdXscCsY|j|tj|jf}tj||jj||j|j|_dS(N(R(RR+RtchdirRRR(RRtsave((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytcd[s   cCsO|jstjdn|jd\}}tj||jd=||_dS(Nsempty directory stacki(RRR&R-R(RtdirR ((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyRbs    cCsD|r$|d}t||}nt|j|}|j|S(NcSstj||S(N(R!(Rtpat((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytkeepls(tfilterR%tsort(RtfilesR1R2((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt_filterjs   cCs"tjtj}|j||S(N(RtlistdirtcurdirR6(RR1R5((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytlistsscCs7tjtj}ttjj|}|j||S(N(RR7R8R3RR)R6(RR1R5((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt listfileswscCs7tjtj}ttjj|}|j||S(N(RR7R8R3RtisdirR6(RR1R5((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt listsubdirs|scCs|j|otjj|S(N(R%RRtexists(RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyR=scCs|j|otjj|S(N(R%RRR;(RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyR;scCs|j|otjj|S(N(R%RRR(RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyRscCs|j|otjj|S(N(R%RRR)(RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyR)scCsa|j|d}t|}tj}x)|j|}|sGPn|j|q.|jS(Niii (R*R tmd5tnewR tupdatetdigest(RRt BUFFERSIZERtsumtbuffer((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyRCs   cCs|j|tj|tS(N(R*RtstattST_SIZE(RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytsizes cCs'|j|tjtj|tS(N(R*ttimet localtimeRREtST_MTIME(RR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytmtimes cCsF|j|tj|t}tjtj|t}||fS(N(R*RRERFRHRIRJ(RRRGRK((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyREs cCsK|j|}tj|t}tjtj|t}|||fS(N(RCRRERFRHRIRJ(RRRCRGRK((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytinfoscCs|dkr|j}ng}x[|D]S}y|j|||fWq(tjtfk rz|j|dfq(Xq(W|S(N(tNoneR:RRR&R (RtfunctionR9tresR((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt_lists  cCs|j|j|S(N(RPRC(RR9((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytsumlistscCs|j|j|S(N(RPRE(RR9((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytstatlistscCs|j|j|S(N(RPRK(RR9((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyt mtimelistscCs|j|j|S(N(RPRG(RR9((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytsizelistscCs|j|j|S(N(RPRL(RR9((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pytinfolistscCsg|dkr|j}ni}x?|D]7}y|||||j|jd}nd}td|f}|jdS(NiiiR](tstringtsystargvtatoiRlt _serverloop(RvRwtporttproxy((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyttest!s   t__main__((t__doc__RmRtR>RR!RERHRR8tpardirRRRnRlRuRsR}Rj(((s*/usr/lib64/python2.7/Demo/pdist/FSProxy.pyts