Your IP : 3.149.229.255


Current Path : /lib64/python2.7/Demo/pdist/
Upload File :
Current File : //lib64/python2.7/Demo/pdist/cmptree.pyo

�
V
�Qc@s�dZddlZddlmZddlZddlZddlZd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
edkr�e�ndS(
sQCompare local and remote dictionaries and transfer differing files -- like rdist.i����N(treprcCs-tj�}td|�}|r>tj|�tj�}ntdd�}d}d}d}dGHtd|�}|r�|}n||f}tj�}tj�}tj||�}	t	||	|�|	j
�|j
�tj�}
|
|}t|d	�\}}
|Gd
Gt|
�GdGHtd�dS(
Nschdir [%s] thostsvoorn.cwi.nliitsMode should be a string of characters, indicating what to do with differences.
r - read different files to local file system
w - write different files to remote file system
c - create new files, either remote or local
d - delete disappearing files, either remote or local
s
mode [%s] i<sminutes andtsecondss[Return to exit] (
tostgetcwdt	raw_inputtchdirtaskttimetFSProxytFSProxyLocalt
FSProxyClienttcomparet_closetdivmodtround(tpwdtsRtporttverbosetmodetaddresstt1tlocaltremotett2tdttminstsecs((s*/usr/lib64/python2.7/Demo/pdist/cmptree.pytmain	s2
	


cCs td||f�}|p|S(Ns%s [%s] (R(tprompttdefaultR((s*/usr/lib64/python2.7/Demo/pdist/cmptree.pyR)scCs3td|t|�f�}|r/tj|�S|S(Ns%s [%s] (Rtstrtstringtatoi(RR R((s*/usr/lib64/python2.7/Demo/pdist/cmptree.pytaskint-s
cCs�HdGttj��GH|jd�}|jd�}|j�dGHi}x$|j�D]\}}|||<qVWdGH|j|�}dGt|�GHi}	x|D]\}}
|
|	|<|j|�st|�GdGHd|kr�d	|kr�t	|||�q�q�||}||
kr�t|�G|j
|�}|j
|�}
||
krrd
Gd|kr�t	|||�q�n6|
|kr�dGd|kr�t|||�q�nd
GHq�q�Wx�|j�D]�}|	j�s�t|�GdGt
�d|krd	|krt|||�n-d|kr<d|kr<tj|�dGHnHq�q�WdGH|j|�}g}x�|D]�}|j|�r�dGt|�GH|j|�qedGt|�GdGHd|kred	|kredt|�}d|kr�d}nt|d�}|d dkr7|j|�dt|�GH|j|�q7qeqeW|j�}x0|D](}||krNdGt|�GdGHqNqNWx[|D]S}dGt|�GH|j|�|j|�t|||�|j�|j�q�WdS(NsPWD =tsumlisttlistsubdirsscalculating local sums ...sgetting remote sums ...tgotsonly remotetrtcsremote newerslocal newertws same mtime but different sum?!?!sonly locallytdsremoved.sgettin subdirs ...sCommon subdirectorysRemote subdirectorysnot found locallys"Create local subdirectory %s? [y] tyitYsSubdirectory %s madesLocal subdirectorysnot found remotelysEntering subdirectory(R,R-(RRRt_sendt_flushR%t_recvtlenthas_keytrecvfiletmtimetsendfiletkeystfltunlinktisdirtappendRtmkdirR&tcdR
tback(RRRtsums_idt
subdirs_idtlsumdicttnametinfotsumstrsumdicttrsumtlsumtrmtimetlmtimetsubdirstcommontprtoktlsubdirs((s*/usr/lib64/python2.7/Demo/pdist/cmptree.pyR
2s�






	





cCs�y|j|�Wn&ttjfk
r9}dG|GHdSXdGt�t|�j�}tj�}|jd||�|j	�tj�}||}t
|�GdGt|�GdG|r�dGtt
|�|�GdGnHdS(Nscannot create:ssending ...twritesbytes inRsi.e.s	bytes/sec(tcreatetIOErrorRterrorR7topentreadR	t
_send_noreplyR/R1R(RRRAtmsgtdataRRR((s*/usr/lib64/python2.7/Demo/pdist/cmptree.pyR5�s"	

cCsPd}z t|||�}d}|SWd|sKd|fGH|j|�nXdS(Niis#*** recvfile of %r failed, deleting(t
recvfile_realtdelete(RRRARLtrv((s*/usr/lib64/python2.7/Demo/pdist/cmptree.pyR3�scCsby|j|�Wn&ttjfk
r9}dG|GHdSXdGt�t|d�}tj�}d}d}|jd|||�}|j�xd||}	|jd||	|�}
|j	|�}|
}|s�Pn|j
|�|j|�|	}q�|j�}tj�}
|j
�|
|}|GdGt|�Gd	G|rPd
G||GdGnH|j	|�dS(
Nscannot create:s
receiving ...R*iiiRSsbytes inRsi.e.s	bytes/seci(RORPRRQR7RRR	R.R/R0tseekRNttelltcloseR(RRRARUtfRtlengthtoffsettidt	newoffsettnewidRVtsizeRR((s*/usr/lib64/python2.7/Demo/pdist/cmptree.pyRW�s@	



	

cCstjj�dS(N(tsyststdouttflush(((s*/usr/lib64/python2.7/Demo/pdist/cmptree.pyR7�st__main__(t__doc__RdRR
R	RRRR$R
R5R3RWR7t__name__(((s*/usr/lib64/python2.7/Demo/pdist/cmptree.pyt<module>s	 			P			&