mirror of https://github.com/acidanthera/audk.git
BaseTools/Scripts/GetMaintainer: refactor internal returns as dicts
To clean up interfaces, change the lookup functions to return dictionaries rather than multiple values. Cc: Rebecca Cran <rebecca@bsdio.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Leif Lindholm <quic_llindhol@quicinc.com> Acked-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
This commit is contained in:
parent
1cb580be85
commit
05f3c3f3d0
|
@ -96,7 +96,7 @@ def get_section_maintainers(path, section):
|
||||||
else:
|
else:
|
||||||
lists += [address]
|
lists += [address]
|
||||||
|
|
||||||
return maintainers, lists
|
return {'maintainers': maintainers, 'lists': lists}
|
||||||
|
|
||||||
def get_maintainers(path, sections, level=0):
|
def get_maintainers(path, sections, level=0):
|
||||||
"""For 'path', iterates over all sections, returning maintainers
|
"""For 'path', iterates over all sections, returning maintainers
|
||||||
|
@ -104,22 +104,24 @@ def get_maintainers(path, sections, level=0):
|
||||||
maintainers = []
|
maintainers = []
|
||||||
lists = []
|
lists = []
|
||||||
for section in sections:
|
for section in sections:
|
||||||
tmp_maint, tmp_lists = get_section_maintainers(path, section)
|
recipients = get_section_maintainers(path, section)
|
||||||
maintainers += tmp_maint
|
maintainers += recipients['maintainers']
|
||||||
lists += tmp_lists
|
lists += recipients['lists']
|
||||||
|
|
||||||
if not maintainers:
|
if not maintainers:
|
||||||
# If no match found, look for match for (nonexistent) file
|
# If no match found, look for match for (nonexistent) file
|
||||||
# REPO.working_dir/<default>
|
# REPO.working_dir/<default>
|
||||||
print('"%s": no maintainers found, looking for default' % path)
|
print('"%s": no maintainers found, looking for default' % path)
|
||||||
if level == 0:
|
if level == 0:
|
||||||
maintainers = get_maintainers('<default>', sections, level=level + 1)
|
recipients = get_maintainers('<default>', sections, level=level + 1)
|
||||||
|
maintainers += recipients['maintainers']
|
||||||
|
lists += recipients['lists']
|
||||||
else:
|
else:
|
||||||
print("No <default> maintainers set for project.")
|
print("No <default> maintainers set for project.")
|
||||||
if not maintainers:
|
if not maintainers:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
return maintainers + lists
|
return {'maintainers': maintainers, 'lists': lists}
|
||||||
|
|
||||||
def parse_maintainers_line(line):
|
def parse_maintainers_line(line):
|
||||||
"""Parse one line of Maintainers.txt, returning any match group and its key."""
|
"""Parse one line of Maintainers.txt, returning any match group and its key."""
|
||||||
|
@ -184,9 +186,8 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
for file in FILES:
|
for file in FILES:
|
||||||
print(file)
|
print(file)
|
||||||
addresslist = get_maintainers(file, SECTIONS)
|
recipients = get_maintainers(file, SECTIONS)
|
||||||
if addresslist:
|
ADDRESSES += recipients['maintainers'] + recipients['lists']
|
||||||
ADDRESSES += addresslist
|
|
||||||
|
|
||||||
for address in list(OrderedDict.fromkeys(ADDRESSES)):
|
for address in list(OrderedDict.fromkeys(ADDRESSES)):
|
||||||
if '<' in address and '>' in address:
|
if '<' in address and '>' in address:
|
||||||
|
|
Loading…
Reference in New Issue