|
27 | 27 | """
|
28 | 28 |
|
29 | 29 | import argparse
|
| 30 | +import fnmatch |
30 | 31 | import logging
|
31 | 32 | import multiprocessing
|
32 | 33 | import os
|
@@ -152,7 +153,8 @@ def main():
|
152 | 153 | parser.add_argument('-i', '--ignore_errors', nargs='*',
|
153 | 154 | help='ignore errors from these projects')
|
154 | 155 | parser.add_argument('--ignore_project', nargs='+',
|
155 |
| - help='do not process given project(s)') |
| 156 | + help='do not process given project(s). ' |
| 157 | + 'The project name can be fnmatch-like pattern') |
156 | 158 | parser.add_argument('-c', '--config', required=True,
|
157 | 159 | help='config file in JSON/YAML format')
|
158 | 160 | parser.add_argument('-U', '--uri', default='http://localhost:8080/source',
|
@@ -273,8 +275,15 @@ def main():
|
273 | 275 | ignored_projects.extend(args.ignore_project)
|
274 | 276 |
|
275 | 277 | if ignored_projects:
|
276 |
| - dirs_to_process = list(set(dirs_to_process) - set(ignored_projects)) |
277 |
| - logger.debug("Removing projects: {}".format(ignored_projects)) |
| 278 | + logger.debug("Removing projects based on the list: {}".format(ignored_projects)) |
| 279 | + filtered_dirs = set(dirs_to_process) |
| 280 | + for dir in dirs_to_process: |
| 281 | + for ignore_pattern in ignored_projects: |
| 282 | + if fnmatch.fnmatchcase(dir, ignore_pattern): |
| 283 | + logger.debug(f"project {dir} matched {ignore_pattern} => removing") |
| 284 | + filtered_dirs.remove(dir) |
| 285 | + |
| 286 | + dirs_to_process = list(filtered_dirs) |
278 | 287 |
|
279 | 288 | logger.debug("directories to process: {}".format(dirs_to_process))
|
280 | 289 |
|
|
0 commit comments