//usr/lib64/lib64//lib64//python2.7/ó
àœSec @ s‹ d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z e j d ƒ Z
d „ Z e d d „ Z d „ Z e d d d „ ƒd „ ƒ Z d
„ Z e d d e ƒd „ ƒ Z e d
d e ƒd „ ƒ Z e j d ƒ Z e d d e ƒd „ ƒ Z e d d e ƒd „ ƒ Z e d d e ƒd „ ƒ Z e d d e ƒd „ ƒ Z d „ Z e d k r‡e ƒ n d S( iÿÿÿÿNt srcdirc C s" d j | | d k r d n d ƒ S( s7 Return 'N file(s)' with the proper plurality on 'file'.s {} file{}i t st ( t format( t count( ( s0 /usr/lib64/python2.7/Tools/scripts/patchcheck.pyt n_files_str s c s ‡ ‡ ‡ f d † } | S( s* Decorator to output status info to stdout.c s ‡ ‡ ‡ ‡ f d † } | S( Nc so t j j ˆ d ƒ t j j ƒ ˆ | | Ž } ˆ rF ˆ rF d GHn% ˆ rZ ˆ | ƒ GHn | rf d n d GH| S( Ns ... t donet yest NO( t syst stdoutt writet flush( t argst kwargst result( t fxnt infot messaget modal( s0 /usr/lib64/python2.7/Tools/scripts/patchcheck.pyt call_fxn s
( ( R R ( R R R ( R s0 /usr/lib64/python2.7/Tools/scripts/patchcheck.pyt
decorated_fxn s ( ( R R R R ( ( R R R s0 /usr/lib64/python2.7/Tools/scripts/patchcheck.pyt status s
c C sx d } t j | j ƒ d t j d t j ƒ} z) | j ƒ \ } } | j d k oT | SWd | j j ƒ | j j ƒ Xd S( s* Check if there are any applied MQ patches.s hg qappliedR
t stderri N( t
subprocesst Popent splitt PIPEt communicatet
returncodeR
t closeR ( t cmdt stt bstdoutt _( ( s0 /usr/lib64/python2.7/Tools/scripts/patchcheck.pyt mq_patches_applied' s
s6 Getting the list of files that have been added/changedR c C s t t | ƒ ƒ S( N( R t len( t x( ( s0 /usr/lib64/python2.7/Tools/scripts/patchcheck.pyt 6 s c C s t j j t j j t d ƒ ƒ rF d } d } t ƒ rt | d 7} qt n. t j j d ƒ rg d } d } n
t j d ƒ t j | j
ƒ d t j ƒ} zg | j ƒ | d k rÑ g | j
D] } | j ƒ j ƒ ^ qµ Sd
„ | j
Dƒ } t d „ | Dƒ ƒ SWd | j
j ƒ Xd S(
s4 Get the list of changed or added files from the VCS.s .hgt hgs( hg status --added --modified --no-statuss --rev qparents .svnt svns7 svn status --quiet --non-interactive --ignore-externalss% need a checkout to get modified filesR
c s sA | ]7 } | d d k r | j ƒ j ƒ j d d ƒ d Vq d S( i t AMi iÿÿÿÿN( t decodet rstript rsplitt None( t .0R% ( ( s0 /usr/lib64/python2.7/Tools/scripts/patchcheck.pys J s c s s' | ] } t j j | ƒ r | Vq d S( N( t ost patht isfile( R. R0 ( ( s0 /usr/lib64/python2.7/Tools/scripts/patchcheck.pys L s N( R/ R0 t isdirt joint SRCDIRR# R t exitR R R R t waitR
R* R+ t setR ( t vcsR R R% t output( ( s0 /usr/lib64/python2.7/Tools/scripts/patchcheck.pyt
changed_files5 s$ !
&
c C sr t | ƒ } | d k r" t | ƒ Sd j t | ƒ ƒ g } x$ | D] } | j d j | ƒ ƒ qA Wd j | ƒ Sd S( Ni s {}:s {}s
( R$ R R t appendR3 ( t
file_pathsR t linesR0 ( ( s0 /usr/lib64/python2.7/Tools/scripts/patchcheck.pyt report_modified_filesQ s
s Fixing whitespacec C s\ t t _ g } xF d „ | Dƒ D]4 } t j t j j t | ƒ ƒ r | j | ƒ q q W| S( sA Make sure that the whitespace for .py files have been normalized.c s s$ | ] } | j d ƒ r | Vq d S( s .pyN( t endswith( R. R% ( ( s0 /usr/lib64/python2.7/Tools/scripts/patchcheck.pys a s ( t Falset reindentt
makebackupt checkR/ R0 R3 R4 R; ( R<