Dynamically find releases for move-implemented-specs

This adds a shallow directory walk to find the available releases for
moving implemented specs, so we don't have to update the script per
release to add a release choice.

Change-Id: I80ea14f07da9361b26645d997de0fcbe4ba19afc
This commit is contained in:
melanie witt 2018-08-16 17:40:08 +00:00
parent df5d815cbe
commit c0112f7166
1 changed files with 11 additions and 8 deletions

View File

@ -23,6 +23,16 @@ from launchpadlib import launchpad
LPCACHEDIR = os.path.expanduser('~/.launchpadlib/cache')
def get_choices():
# 3-tuple (dirpath, dirnames, filenames)
for _, choices, _ in os.walk('specs'):
choices.remove('backlog')
choices.sort()
# Quit walking (release dirs are at the first level in 'specs')
break
return choices
def get_options():
parser = argparse.ArgumentParser(
description='Move implemented specs for a given release. Requires '
@ -33,14 +43,7 @@ def get_options():
help='Do everything except move the files.',
action='store_true')
parser.add_argument('release', help='The release to process.',
choices=['juno',
'kilo',
'liberty',
'mitaka',
'newton',
'ocata',
'pike',
'queens'])
choices=get_choices())
return parser.parse_args()