# HG changeset patch # Parent 7d259468cff07b10e8b52242464d259342d7eba7 diff --git a/Tools/scripts/patchcheck.py b/Tools/scripts/patchcheck.py --- a/Tools/scripts/patchcheck.py +++ b/Tools/scripts/patchcheck.py @@ -53,11 +53,8 @@ def normalize_whitespace(file_paths): @status("Docs modified", modal=True) def docs_modified(file_paths): - """Report if any files in the Docs directory.""" - for path in file_paths: - if path.startswith("Doc"): - return True - return False + """Report if any file in the Doc directory has been changed.""" + return bool(file_paths) @status("Misc/ACKS updated", modal=True) def credit_given(file_paths): @@ -72,14 +69,18 @@ def reported_news(file_paths): def main(): file_paths = changed_files() - # PEP 7/8 verification. - normalize_whitespace(file_paths) + python_files = [fn for fn in file_paths if fn.endswith('.py')] + c_files = [fn for fn in file_paths if fn.endswith(('.c', '.h'))] + docs = [fn for fn in file_paths if file_paths.startswith('Doc')] + special_files = {'Misc/ACKS', 'Misc/NEWS'} & set(file_paths) + # PEP 8 whitespace rules enforcement. + normalize_whitespace(python_files) # Docs updated. - docs_modified(file_paths) + docs_modified(docs) # Misc/ACKS changed. - credit_given(file_paths) + credit_given(special_files) # Misc/NEWS changed. - reported_news(file_paths) + reported_news(special_files) # Test suite run and passed. print()