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 <ricardo.martincoski@gmail.com>
[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 <thomas.petazzoni@bootlin.com>
This commit is contained in:
Ricardo Martincoski 2022-07-23 16:19:36 +02:00 committed by Thomas Petazzoni
parent 4ed7bca6a0
commit 7082b0585d
2 changed files with 5 additions and 3 deletions

View File

@ -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)

View File

@ -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