election/tools/render-wiki-list.py
Tony Breeds 5fdebb419c render-wiki-list: Only remove the TC if needed
If the TC election hasn't been opened then render-wiki-list will fail with:
---
 Traceback (most recent call last):
   File "tools/render-wiki-list.py", line 31, in <module>
     main(sys.argv)
   File "tools/render-wiki-list.py", line 17, in main
     candidates_list['projects'].remove('TC')
 ValueError: list.remove(x): x not in list
---

Fix that

Change-Id: I5292655d14871b2b3047be0d2720423acfdab9e3
2016-03-11 16:52:38 +11:00

33 lines
1.0 KiB
Python
Executable File

#!/usr/bin/env python
import sys
sys.path.append("doc/source/_exts")
from candidates import build_candidates_list
GIT_BASE = 'http://git.openstack.org/cgit/openstack/election/plain/'
def main(argv):
if len(argv) != 2 or argv[1] not in ("PTL", "TC"):
print "usage: %s PTL|TC" % argv[0]
return
candidates_list = build_candidates_list("newton")
if argv[1] == "PTL":
if 'TC' in candidates_list['projects']:
candidates_list['projects'].remove('TC')
else:
candidates_list['projects'] = ['TC']
for project in candidates_list['projects']:
print "* %s" % project.replace('_', ' ')
for candidate in candidates_list['candidates'][project]:
candidate_name = candidate.split('/')[-1][:-4].replace('_', ' ')
candidate_name = candidate_name.title()
print "** [%s/%s %s]" % (GIT_BASE,
candidate.replace(' ', '%20'),
candidate_name)
if __name__ == "__main__":
main(sys.argv)