From 7082b0585d5a231a062087d3e44007742b9165d4 Mon Sep 17 00:00:00 2001 From: Ricardo Martincoski Date: Sat, 23 Jul 2022 16:19:36 +0200 Subject: [PATCH] utils/get-developers: add -d option for custom DEVELOPERS file In preparation to the introduction of test cases for the get-developers script, make it possible to pass a custom DEVELOPERS file. A normal user of get-developers will most likely never use this, but the test suite will use it. Signed-off-by: Ricardo Martincoski [Thomas: extracted from a larger patch from Ricardo, initially posted at https://patchwork.ozlabs.org/project/buildroot/patch/20220528014832.289907-1-ricardo.martincoski@gmail.com/] Signed-off-by: Thomas Petazzoni --- utils/get-developers | 4 +++- utils/getdeveloperlib.py | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/utils/get-developers b/utils/get-developers index 158867ce3f..9ab5c4503f 100755 --- a/utils/get-developers +++ b/utils/get-developers @@ -21,6 +21,8 @@ def parse_args(): const=True, help='only list affected developer email addresses') parser.add_argument('-v', dest='validate', action='store_const', const=True, help='validate syntax of DEVELOPERS file') + parser.add_argument('-d', dest='filename', action='store', default=None, + help='override the default DEVELOPERS file (for debug)') return parser.parse_args() @@ -48,7 +50,7 @@ def __main__(): print("No action specified") return - devs = getdeveloperlib.parse_developers() + devs = getdeveloperlib.parse_developers(args.filename) if devs is None: sys.exit(1) diff --git a/utils/getdeveloperlib.py b/utils/getdeveloperlib.py index c05e1f888b..2a8d5c213c 100644 --- a/utils/getdeveloperlib.py +++ b/utils/getdeveloperlib.py @@ -225,13 +225,13 @@ def parse_developer_runtime_tests(fnames): return runtimes -def parse_developers(): +def parse_developers(filename=None): """Parse the DEVELOPERS file and return a list of Developer objects.""" developers = [] linen = 0 global unittests unittests = list_unittests() - developers_fname = os.path.join(brpath, 'DEVELOPERS') + developers_fname = filename or os.path.join(brpath, 'DEVELOPERS') with open(developers_fname, mode='r', encoding='utf_8') as f: files = [] name = None