]>
Commit | Line | Data |
---|---|---|
850098eb | 1 | #!/usr/bin/env python3 |
81f86cb9 | 2 | |
83ffe9cd | 3 | # Copyright (C) 2017-2023 Free Software Foundation, Inc. |
850098eb ML |
4 | # |
5 | # Checks some of the GNU style formatting rules in a set of patches. | |
6 | # The script is a rewritten of the same bash script and should eventually | |
7 | # replace the former script. | |
8 | # | |
9 | # This file is part of GCC. | |
10 | # | |
11 | # GCC is free software; you can redistribute it and/or modify it under | |
12 | # the terms of the GNU General Public License as published by the Free | |
13 | # Software Foundation; either version 3, or (at your option) any later | |
14 | # version. | |
15 | # | |
16 | # GCC is distributed in the hope that it will be useful, but WITHOUT ANY | |
17 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
18 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
19 | # for more details. | |
20 | # | |
21 | # You should have received a copy of the GNU General Public License | |
22 | # along with GCC; see the file COPYING3. If not see | |
23 | # <http://www.gnu.org/licenses/>. */ | |
850098eb | 24 | |
850098eb | 25 | import argparse |
75017bb9 | 26 | import sys |
b7fc9ae0 | 27 | from check_GNU_style_lib import check_GNU_style_file |
850098eb ML |
28 | |
29 | def main(): | |
30 | parser = argparse.ArgumentParser(description='Check GNU coding style.') | |
31 | parser.add_argument('file', help = 'File with a patch') | |
32 | parser.add_argument('-f', '--format', default = 'stdio', | |
33 | help = 'Display format', | |
34 | choices = ['stdio', 'quickfix']) | |
35 | args = parser.parse_args() | |
75017bb9 TV |
36 | filename = args.file |
37 | format = args.format | |
38 | ||
39 | if filename == '-': | |
b0451799 | 40 | check_GNU_style_file(sys.stdin, format) |
75017bb9 | 41 | else: |
b0451799 ML |
42 | with open(filename, newline='\n') as diff_file: |
43 | check_GNU_style_file(diff_file, format) | |
850098eb | 44 | |
b7fc9ae0 | 45 | main() |