Print out maintainer info with -m or --maintainers

Huge thanks to Paul (javelinanddart) for cleaning things up

Change-Id: Id477ac948cf1d55663eeb3ddf7cc025a81b97ebf
This commit is contained in:
Harry Youd
2017-06-03 15:15:13 -05:00
parent a8794d605a
commit a9c6df223f

View File

@@ -4,9 +4,14 @@ import yaml
import re import re
import os import os
import json import json
import argparse
mydir = os.path.dirname(os.path.abspath(__file__)) mydir = os.path.dirname(os.path.abspath(__file__))
parser = argparse.ArgumentParser()
parser.add_argument('-m', '--maintainers', help='list maintainers for devices', action='store_true', required=False)
args = parser.parse_args()
# Paths to certain repos # Paths to certain repos
repo = { repo = {
"updater": "../../updater", "updater": "../../updater",
@@ -91,3 +96,23 @@ for codename in codenames:
print("{} doesn't have a root method field".format(codename)) print("{} doesn't have a root method field".format(codename))
except KeyError: except KeyError:
print("{} doesn't have an install method field".format(codename)) print("{} doesn't have an install method field".format(codename))
# Optionally print out all maintainer info
if args.maintainers:
print("---------------MAINTAINER INFO DUMP---------------")
for codename in codenames:
wiki_yml_file = os.path.join(mydir, repo["wiki"] + "/_data/devices/" + codename + ".yml")
toprint = "{}:".format(codename)
if not os.path.isfile(wiki_yml_file):
# Skip devices without wiki pages, we already errored about it
continue
with open(wiki_yml_file) as f:
yml = yaml.load(f)
try:
for maintainer in yml["maintainers"]:
toprint += ", {}".format(maintainer)
except KeyError:
# Skip devices without maintainer fields, we already errored about it
continue
print(toprint.replace(":,", ":"))