list_constraints: handle unreleased deliverables

This commmand assumed all deliverables would have a release.
It will now capture this and print out a list at the end of
deliverables that did not include releases.

Change-Id: Ib2834aed97af0f08bac25fbe0769258b385007f2
This commit is contained in:
Sean McGinnis 2018-02-02 13:58:51 -06:00
parent dc0a857d6f
commit ca0a575e7b

View File

@ -38,14 +38,23 @@ def main():
print('no deliverable files found under {}'.format(args.series))
return 1
missing = []
for filename in filenames:
with open(filename, 'r', encoding='utf-8') as f:
deliverable_info = yamlutils.loads(f.read())
deliverable_name = os.path.splitext(os.path.basename(filename))[0]
if not deliverable_info.get('releases'):
missing.append(deliverable_name)
continue
# assume the releases are in order and take the last one
new_release = deliverable_info['releases'][-1]
print('{}==={}'.format(deliverable_name, new_release['version']))
# print out any deliverables without releases
if missing:
print('\nMissing releases:\n {}'.format('\n '.join(missing)))
return 0