77import subprocess
88import sysconfig
99
10- import reindent
1110import untabify
1211
1312
@@ -184,21 +183,6 @@ def report_modified_files(file_paths):
184183})
185184
186185
187- @status ("Fixing Python file whitespace" , info = report_modified_files )
188- def normalize_whitespace (file_paths ):
189- """Make sure that the whitespace for .py files have been normalized."""
190- reindent .makebackup = False # No need to create backups.
191- fixed = [
192- path for path in file_paths
193- if (
194- path .endswith ('.py' )
195- and path not in _PYTHON_FILES_WITH_TABS
196- and reindent .check (os .path .join (SRCDIR , path ))
197- )
198- ]
199- return fixed
200-
201-
202186@status ("Fixing C file whitespace" , info = report_modified_files )
203187def normalize_c_whitespace (file_paths ):
204188 """Report if any C files """
@@ -256,10 +240,8 @@ def ci(pull_request):
256240 return
257241 base_branch = get_base_branch ()
258242 file_paths = changed_files (base_branch )
259- python_files = [fn for fn in file_paths if fn .endswith ('.py' )]
260243 c_files = [fn for fn in file_paths if fn .endswith (('.c' , '.h' ))]
261244 fixed = []
262- fixed .extend (normalize_whitespace (python_files ))
263245 fixed .extend (normalize_c_whitespace (c_files ))
264246 if not fixed :
265247 print ('No whitespace issues found' )
@@ -273,13 +255,10 @@ def ci(pull_request):
273255def main ():
274256 base_branch = get_base_branch ()
275257 file_paths = changed_files (base_branch )
276- python_files = [fn for fn in file_paths if fn .endswith ('.py' )]
277258 c_files = [fn for fn in file_paths if fn .endswith (('.c' , '.h' ))]
278259 doc_files = [fn for fn in file_paths if fn .startswith ('Doc' ) and
279260 fn .endswith (('.rst' , '.inc' ))]
280261 misc_files = {p for p in file_paths if p .startswith ('Misc' )}
281- # PEP 8 whitespace rules enforcement.
282- normalize_whitespace (python_files )
283262 # C rules enforcement.
284263 normalize_c_whitespace (c_files )
285264 # Docs updated.
@@ -294,10 +273,13 @@ def main():
294273 regenerated_pyconfig_h_in (file_paths )
295274
296275 # Test suite run and passed.
297- if python_files or c_files :
298- end = " and check for refleaks?" if c_files else "?"
299- print ()
300- print ("Did you run the test suite" + end )
276+ has_c_files = any (fn for fn in file_paths if fn .endswith (('.c' , '.h' )))
277+ has_python_files = any (fn for fn in file_paths if fn .endswith ('.py' ))
278+ print ()
279+ if has_c_files :
280+ print ("Did you run the test suite and check for refleaks?" )
281+ elif has_python_files :
282+ print ("Did you run the test suite?" )
301283
302284
303285if __name__ == '__main__' :
0 commit comments