diff --git a/tools/check_dissector_urls.py b/tools/check_dissector_urls.py index 4f4c70c90b..e070b605a0 100755 --- a/tools/check_dissector_urls.py +++ b/tools/check_dissector_urls.py @@ -166,7 +166,7 @@ def find_links_in_folder(folder): # command-line args. Controls which dissector files should be scanned. # If no args given, will just scan epan/dissectors folder. parser = argparse.ArgumentParser(description='Check URL links in dissectors') -parser.add_argument('--file', action='store', default='', +parser.add_argument('--file', action='append', help='specify individual dissector file to test') parser.add_argument('--commits', action='store', help='last N commits to check') @@ -185,9 +185,15 @@ def is_dissector_file(filename): # Get files from wherever command-line args indicate. if args.file: - # Fetch links from single file. - find_links_in_file(args.file) - files.append(args.file) + # Add specified file(s) + for f in args.file: + if not f.startswith('epan'): + f = os.path.join('epan', 'dissectors', f) + if not os.path.isfile(f): + print('Chosen file', f, 'does not exist.') + exit(1) + else: + files.append(f) elif args.commits: # Get files affected by specified number of commits. command = ['git', 'diff', '--name-only', 'HEAD~' + args.commits] diff --git a/tools/check_spelling.py b/tools/check_spelling.py index 0ff7ec0c01..aeb16244c0 100755 --- a/tools/check_spelling.py +++ b/tools/check_spelling.py @@ -387,7 +387,7 @@ def checkFile(filename): # command-line args. Controls which files should be checked. # If no args given, will just scan epan/dissectors folder. parser = argparse.ArgumentParser(description='Check spellings in specified files') -parser.add_argument('--file', action='store', default='', +parser.add_argument('--file', action='append', help='specify individual file to test') parser.add_argument('--folder', action='store', default='', help='specify folder to test') @@ -404,12 +404,13 @@ args = parser.parse_args() # Get files from wherever command-line args indicate. files = [] if args.file: - # Add single specified file.. - if not os.path.isfile(args.file): - print('Chosen file', args.file, 'does not exist.') - exit(1) - else: - files.append(args.file) + # Add specified file(s) + for f in args.file: + if not os.path.isfile(f): + print('Chosen file', f, 'does not exist.') + exit(1) + else: + files.append(f) elif args.commits: # Get files affected by specified number of commits. command = ['git', 'diff', '--name-only', 'HEAD~' + args.commits] diff --git a/tools/check_static.py b/tools/check_static.py index 73606d1c1a..4168623ec7 100755 --- a/tools/check_static.py +++ b/tools/check_static.py @@ -222,7 +222,7 @@ issues_found = 0 parser = argparse.ArgumentParser(description='Check calls in dissectors') parser.add_argument('--build', action='store', default='', help='build folder', required=False) -parser.add_argument('--file', action='store', default='', +parser.add_argument('--file', action='append', help='specify individual dissector file to test') parser.add_argument('--commits', action='store', help='last N commits to check') @@ -239,11 +239,15 @@ if args.build: build_folder = args.build if args.file: - # Add single specified file.. - if not args.file.startswith('epan'): - files.append(os.path.join('epan', 'dissectors', args.file)) - else: - files.append(args.file) + # Add specified file(s) + for f in args.file: + if not f.startswith('epan'): + f = os.path.join('epan', 'dissectors', f) + if not os.path.isfile(f): + print('Chosen file', f, 'does not exist.') + exit(1) + else: + files.append(f) elif args.commits: # Get files affected by specified number of commits. command = ['git', 'diff', '--name-only', 'HEAD~' + args.commits] diff --git a/tools/check_tfs.py b/tools/check_tfs.py index 3252d3b15b..b1ad33e54e 100755 --- a/tools/check_tfs.py +++ b/tools/check_tfs.py @@ -163,7 +163,7 @@ def checkFile(filename, tfs_items, look_for_common=False): # command-line args. Controls which dissector files should be checked. # If no args given, will just scan epan/dissectors folder. parser = argparse.ArgumentParser(description='Check calls in dissectors') -parser.add_argument('--file', action='store', default='', +parser.add_argument('--file', action='append', help='specify individual dissector file to test') parser.add_argument('--commits', action='store', help='last N commits to check') @@ -179,11 +179,15 @@ args = parser.parse_args() # Get files from wherever command-line args indicate. files = [] if args.file: - # Add single specified file.. - if not args.file.startswith('epan'): - files.append(os.path.join('epan', 'dissectors', args.file)) - else: - files.append(args.file) + # Add specified file(s) + for f in args.file: + if not f.startswith('epan'): + f = os.path.join('epan', 'dissectors', f) + if not os.path.isfile(f): + print('Chosen file', f, 'does not exist.') + exit(1) + else: + files.append(f) elif args.commits: # Get files affected by specified number of commits. command = ['git', 'diff', '--name-only', 'HEAD~' + args.commits] diff --git a/tools/check_typed_item_calls.py b/tools/check_typed_item_calls.py index 944350047b..5ebd0d039f 100755 --- a/tools/check_typed_item_calls.py +++ b/tools/check_typed_item_calls.py @@ -665,7 +665,7 @@ def checkFile(filename, check_mask=False, check_label=False, check_consecutive=F # command-line args. Controls which dissector files should be checked. # If no args given, will just scan epan/dissectors folder. parser = argparse.ArgumentParser(description='Check calls in dissectors') -parser.add_argument('--file', action='store', default='', +parser.add_argument('--file', action='append', help='specify individual dissector file to test') parser.add_argument('--folder', action='store', default='', help='specify folder to test') @@ -690,11 +690,15 @@ args = parser.parse_args() # Get files from wherever command-line args indicate. files = [] if args.file: - # Add single specified file - if not args.file.startswith('epan') and not os.path.exists(args.file): - files.append(os.path.join('epan', 'dissectors', args.file)) - else: - files.append(args.file) + # Add specified file(s) + for f in args.file: + if not f.startswith('epan'): + f = os.path.join('epan', 'dissectors', f) + if not os.path.isfile(f): + print('Chosen file', f, 'does not exist.') + exit(1) + else: + files.append(f) elif args.folder: # Add all files from a given folder. folder = args.folder