ó x”þfc@s‹ddlZddlZddlZddlZddlZddlZddlZddlZej dƒZ d„Z e dd„Zd„Zeddd„ƒd „ƒZd „Zed deƒ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.pyt n_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.s hg qappliedR tstderriN( t subprocesstPopentsplittPIPEt communicatet 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.pyt6scCstjjtjjtdƒƒ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 Jscss'|]}tjj|ƒr|VqdS(N(tostpathtisfile(R.R0((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys 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 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_givenssMisc/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.pyts0