7
7
import subprocess
8
8
import sysconfig
9
9
10
- import reindent
11
10
import untabify
12
11
13
12
@@ -184,21 +183,6 @@ def report_modified_files(file_paths):
184
183
})
185
184
186
185
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
-
202
186
@status ("Fixing C file whitespace" , info = report_modified_files )
203
187
def normalize_c_whitespace (file_paths ):
204
188
"""Report if any C files """
@@ -256,10 +240,8 @@ def ci(pull_request):
256
240
return
257
241
base_branch = get_base_branch ()
258
242
file_paths = changed_files (base_branch )
259
- python_files = [fn for fn in file_paths if fn .endswith ('.py' )]
260
243
c_files = [fn for fn in file_paths if fn .endswith (('.c' , '.h' ))]
261
244
fixed = []
262
- fixed .extend (normalize_whitespace (python_files ))
263
245
fixed .extend (normalize_c_whitespace (c_files ))
264
246
if not fixed :
265
247
print ('No whitespace issues found' )
@@ -273,13 +255,10 @@ def ci(pull_request):
273
255
def main ():
274
256
base_branch = get_base_branch ()
275
257
file_paths = changed_files (base_branch )
276
- python_files = [fn for fn in file_paths if fn .endswith ('.py' )]
277
258
c_files = [fn for fn in file_paths if fn .endswith (('.c' , '.h' ))]
278
259
doc_files = [fn for fn in file_paths if fn .startswith ('Doc' ) and
279
260
fn .endswith (('.rst' , '.inc' ))]
280
261
misc_files = {p for p in file_paths if p .startswith ('Misc' )}
281
- # PEP 8 whitespace rules enforcement.
282
- normalize_whitespace (python_files )
283
262
# C rules enforcement.
284
263
normalize_c_whitespace (c_files )
285
264
# Docs updated.
@@ -294,10 +273,13 @@ def main():
294
273
regenerated_pyconfig_h_in (file_paths )
295
274
296
275
# 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?" )
301
283
302
284
303
285
if __name__ == '__main__' :
0 commit comments