AlkantarClanX12

Your IP : 3.142.201.93


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

�
�fc@sddlZddlZddlZddlZddlZddlZddlZddlZej	j
ddd�ej	j
ddd�ej	j
ddd�ej	j
dd�ej	j
dd�gZejd	�Z
d
�Zedd�Zd�Zd
�Zeddd��d��Zeddd��dd��Zd�Zedde�d��Zedde�d��Zejd�Zedde�d��Zedde�d��Zed de�d!��Zed"de�d#��Zd$�Z e!d%kre �ndS(&i����NtModulest_ctypestlibffit
libffi_osxtlibffi_msvctexpattzlibtsrcdircCs"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
cCsBdj�}ytj|dtj�SWntjk
r=dSXdS(s0Get the symbolic name for the current git branchsgit rev-parse --abbrev-ref HEADtstderrN(tsplitt
subprocesstcheck_outputtPIPEtCalledProcessErrortNone(tcmd((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytget_git_branch.s
cCsBdj�}ytj|dtj�Wntjk
r=dSXdS(skGet the remote name to use for upstream branches

    Uses "upstream" if it exists, "origin" otherwise
    sgit remote get-url upstreamRtorigintupstream(RR R!R"R#(R%((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytget_git_upstream_remote7ssGetting base branch for PRRcCs|dk	r|SdS(Nsnot a PR branch(R$(tx((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt<lambda>ER	cCs�tjjtjjtd��s%dStj}|jdkrFd}ndj	|�}t
�}|dksv||krzdSt�}|d|S(Ns.gittalphatmasters{0.major}.{0.minor}t/(tostpathtexiststjointSRCDIRR$Rtversion_infotreleaselevelR
R&R)(tversiontbase_branchtthis_branchtupstream_remote((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytget_base_branchDs!				s6Getting the list of files that have been added/changedcCstt|��S(N(Rtlen(R*((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyR+XR	csvtjjtjjtd��r
|r4d|}nd}g}tj|j�dtj�}z�x�|j	D]�}|j
�j�}|jd	d�\}�t
|�}|jd�s�qknd�kr��jdd�dj��n|j��qkWWd	|j	j�Xn
tjd
�g}xO|D]G�tjj���t�fd�tD��raq'n|j��q'W|S(s0Get the list of changed or added files from git.s.gitsgit diff --name-status sgit status --porcelainRitMAUs -> iNs)need a git checkout to get modified filesc3s|]}�j|�VqdS(N(t
startswith(t.0R0(tfilename(s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys	<genexpr>zs(R/R0R1R2R3R tPopenRR"RtdecodetrstripR$tsettintersectiontstriptappendtcloseRtexittnormpathtanytEXCLUDE_DIRS(R7R%t	filenameststtlinetstatus_textRt
filenames2((R?s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt
changed_filesWs2!


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

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>�s(	tFalsetreindentt
makebackuptcheckR/R0R2R3RF(RRtfixedR0((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/R0R2R3topentreadtuntabifytprocessRVRF(RRRZR0tabspathtf((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytnormalize_c_whitespace�s
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/R0R2R3R^t	readlinestws_retsubtshutiltcopyfilet
writelinesRFt	Exception(	RRRZR0RbRcRSRNt	new_linesterr((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytnormalize_docs_whitespace�s
%s
Docs modifiedRcCs
t|�S(s9Report if any file in the Doc directory has been changed.(tbool(RR((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt
docs_modified�ssMisc/ACKS updatedcCstjjdd�|kS(s$Check if Misc/ACKS has been changed.tMisctACKS(R/R0R2(RR((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytcredit_given�ss Misc/NEWS.d updated with `blurb`cCstd�|D��S(s&Check if Misc/NEWS.d has been changed.css0|]&}|jtjjddd��VqdS(RssNEWS.dtnextN(R=R/R0R2(R>tp((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys	<genexpr>�s(RJ(RR((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt
reported_news�s	cCst�}t|�}g|D]}|jd�r|^q}g|D]}|jd�rD|^qD}g|D]*}|jd�rl|jd�rl|^ql}d�|D�}t|�t|�t|�t|�t|�t	|�|s�|r|rdnd	}Hd
|GHndS(
Ns.pys.cs.htDocs.rsts.inccSs%h|]}|jd�r|�qS(Rs(R=(R>Rw((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pys	<setcomp>�s	s and check for refleaks?t?sDid you run the test suite(s.cs.h(s.rsts.inc(
R:RQRUR=R[RdRpRrRuRx(R7RRtfntpython_filestc_filest	doc_filest
misc_filestend((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pytmain�s"	((





t__main__("treRRjtos.pathR/R t	sysconfigRWR`R0R2RKtget_config_varR3RRVR$RR&R)R:RQRTR[RdtcompileRhRptTrueRrRuRxR�t__name__(((s0/usr/lib64/python2.7/Tools/scripts/patchcheck.pyt<module>sB				
			)