Your IP : 3.22.51.241


Current Path : /lib64/python2.7/Tools/scripts/
Upload File :
Current File : //lib64/python2.7/Tools/scripts/patchcheck.pyc

�
�mec@s�ddlZddlZddlZddlZddlZddlZddlZddlZej	d�Z
d�Zedd�Zd�Zeddd��d	��Zd
�Zedde�d��Zed
de�d��Zejd�Zedde�d��Zedde�d��Zedde�d��Zedde�d��Zd�Zedkr�e�ndS(i����NtsrcdircCs"dj||dkrdnd�S(s7Return 'N file(s)' with the proper plurality on 'file'.s	{} file{}itst(tformat(tcount((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytn_files_strscs���fd�}|S(s*Decorator to output status info to stdout.cs����fd�}|S(Ncsotjj�d�tjj��||�}�rF�rFdGHn%�rZ�|�GHn|rfdndGH|S(Ns ... tdonetyestNO(tsyststdouttwritetflush(targstkwargstresult(tfxntinfotmessagetmodal(s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytcall_fxns
((RR(RRR(Rs0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt
decorated_fxns((RRRR((RRRs0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytstatuss
cCsxd}tj|j�dtjdtj�}z)|j�\}}|jdkoT|SWd|jj�|jj�XdS(s*Check if there are any applied MQ patches.shg qappliedR
tstderriN(	t
subprocesstPopentsplittPIPEtcommunicatet
returncodeR
tcloseR(tcmdtsttbstdoutt_((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytmq_patches_applied's	
s6Getting the list of files that have been added/changedRcCstt|��S(N(Rtlen(tx((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt<lambda>6scCstjjtjjtd��rFd}d}t�rt|d7}qtn.tjjd�rgd}d}n
tjd�tj	|j
�d	tj�}zg|j�|dkr�g|j
D]}|j�j�^q�Sd
�|j
D�}td�|D��SWd|j
j�XdS(
s4Get the list of changed or added files from the VCS.s.hgthgs(hg status --added --modified --no-statuss --rev qparents.svntsvns7svn status --quiet --non-interactive --ignore-externalss%need a checkout to get modified filesR
cssA|]7}|ddkr|j�j�jdd�dVqdS(itAMii����N(tdecodetrstriptrsplittNone(t.0R%((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys	<genexpr>Jscss'|]}tjj|�r|VqdS(N(tostpathtisfile(R.R0((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys	<genexpr>LsN(R/R0tisdirtjointSRCDIRR#R	texitRRRRtwaitR
R*R+tsetR(tvcsRR R%toutput((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt
changed_files5s$!		

&
cCsrt|�}|dkr"t|�Sdjt|��g}x$|D]}|jdj|��qAWdj|�SdS(Nis{}:s  {}s
(R$RRtappendR3(t
file_pathsRtlinesR0((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytreport_modified_filesQs

sFixing whitespacecCs\tt_g}xFd�|D�D]4}tjtjjt|��r |j|�q q W|S(sAMake sure that the whitespace for .py files have been normalized.css$|]}|jd�r|VqdS(s.pyN(tendswith(R.R%((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys	<genexpr>as(	tFalsetreindentt
makebackuptcheckR/R0R3R4R;(R<tfixedR0((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytnormalize_whitespace\s	sFixing C file whitespacecCs�g}xv|D]n}tjjt|�}t|d��}d|j�krRw
nWdQXtj|ddt�|j	|�q
W|S(sReport if any C files trs	Nitverbose(
R/R0R3R4topentreadtuntabifytprocessR@R;(R<RDR0tabspathtf((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytnormalize_c_whitespacegs
s\s+(\r?\n)$sFixing docs whitespacec	Cs�g}x�|D]�}tjjt|�}y�t|d��}|j�}WdQXg|D]}tjd|�^qV}||kr�tj	||d�t|d��}|j
|�WdQX|j|�nWq
tk
r�}d||fGHq
Xq
W|S(Ntrbs\1s.baktwbsCannot fix %s: %s(
R/R0R3R4RHt	readlinestws_retsubtshutiltcopyfilet
writelinesR;t	Exception(	R<RDR0RLRMR=tlinet	new_linesterr((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytnormalize_docs_whitespacews
%s
Docs modifiedRcCs
t|�S(s9Report if any file in the Doc directory has been changed.(tbool(R<((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt
docs_modified�ssMisc/ACKS updatedcCs
d|kS(s$Check if Misc/ACKS has been changed.s	Misc/ACKS((R<((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytcredit_given�ssMisc/NEWS updatedcCs
d|kS(s$Check if Misc/NEWS has been changed.s	Misc/NEWS((R<((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt
reported_news�scCst�}g|D]}|jd�r|^q}g|D]}|jd
�r8|^q8}g|D]}|jd�r`|^q`}ddht|�@}t|�t|�t|�t|�t|�t	|�|s�|r�|r�dnd}Hd	|GHndS(Ns.pys.cs.htDocs	Misc/ACKSs	Misc/NEWSs and check for refleaks?t?sDid you run the test suite(s.cs.h(
R:R?t
startswithR7RERNR[R]R^R_(R<tfntpython_filestc_filest	doc_filest
special_filestend((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytmain�s	(((





t__main__(treR	RTtos.pathR/Rt	sysconfigRARJtget_config_varR4RR@R-RR#R:R>RERNtcompileRRR[tTrueR]R^R_Rit__name__(((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt<module>s0