Use yaml keys to locate the project deliverables

Due to the election setup and we can't trivially map the directory
names to project keys.  This wasn't caught during creation of the
election.  Rather then rename directories while the election is in
progress reverse the look up direction to map project keys =>
directories.

Change-Id: Ib9595d20202328f111bb9cce3c97147cd393f7b7
This commit is contained in:
Tony Breeds 2016-03-11 16:30:39 +11:00
parent 7c72cd4444
commit f013acfaa0

View File

@ -7,6 +7,7 @@ import urllib
import re
import datetime
import pytz
import string
DATE_MIN = '2015-03-04'
DATE_MAX = '2016-01-03'
@ -53,7 +54,6 @@ except:
print "usage: %s candidacy_file" % sys.argv[0]
exit(1)
project_name = project_name.replace('_', ' ')
author = author.replace('_', ' ')
if not os.path.isfile('.projects.yaml'):
@ -61,15 +61,22 @@ if not os.path.isfile('.projects.yaml'):
urllib.urlopen(PROJECTS_URL).read()
)
projects = yaml.load(open('.projects.yaml'))
project_list = None
if project_name == "TC":
project_list = projects.values()
else:
try:
project_list = [projects[project_name]]
except:
print "Can't find project [%s] in %s" % (project_name, projects.keys())
exit(1)
for key in projects.keys():
for dirname in [key, string.capwords(key, '-'),
key.replace(' ', '_'),
string.capwords(key.replace(' ', '_'), '_')]:
if dirname == project_name:
project_list = [projects[key]]
break
if project_list is None:
print "Can't find project [%s] in %s" % (project_name, projects.keys())
exit(1)
for project in project_list:
if 'extra-atcs' in project: