diff options
author | Adam Turner <9087854+AA-Turner@users.noreply.github.com> | 2023-10-10 14:40:08 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-10 07:40:08 -0600 |
commit | f5edb56328b46f262b74a53343b8098a3934f761 (patch) | |
tree | fed13d22ab5ac81f469f4ee7f3a0a92f6cf06c96 /Tools/patchcheck/untabify.py | |
parent | e24f9ae7035cfb4c11c4a5c2820121fc22463f8b (diff) | |
download | cpython-f5edb56328b46f262b74a53343b8098a3934f761.tar.gz cpython-f5edb56328b46f262b74a53343b8098a3934f761.zip |
GH-109408: Move the C file whitespace check from patchcheck to pre-commit (#109890)
Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
Diffstat (limited to 'Tools/patchcheck/untabify.py')
-rwxr-xr-x | Tools/patchcheck/untabify.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Tools/patchcheck/untabify.py b/Tools/patchcheck/untabify.py index 861c83ced90..5c9d1208540 100755 --- a/Tools/patchcheck/untabify.py +++ b/Tools/patchcheck/untabify.py @@ -21,8 +21,7 @@ def main(): if optname == '-t': tabsize = int(optvalue) - for filename in args: - process(filename, tabsize) + return max(process(filename, tabsize) for filename in args) def process(filename, tabsize, verbose=True): @@ -32,10 +31,10 @@ def process(filename, tabsize, verbose=True): encoding = f.encoding except IOError as msg: print("%r: I/O error: %s" % (filename, msg)) - return + return 2 newtext = text.expandtabs(tabsize) if newtext == text: - return + return 0 backup = filename + "~" try: os.unlink(backup) @@ -49,7 +48,8 @@ def process(filename, tabsize, verbose=True): f.write(newtext) if verbose: print(filename) + return 1 if __name__ == '__main__': - main() + raise SystemExit(main()) |