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:
@@ -23,6 +23,16 @@ from launchpadlib import launchpad
|
|||||||
LPCACHEDIR = os.path.expanduser('~/.launchpadlib/cache')
|
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():
|
def get_options():
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='Move implemented specs for a given release. Requires '
|
description='Move implemented specs for a given release. Requires '
|
||||||
@@ -33,14 +43,7 @@ def get_options():
|
|||||||
help='Do everything except move the files.',
|
help='Do everything except move the files.',
|
||||||
action='store_true')
|
action='store_true')
|
||||||
parser.add_argument('release', help='The release to process.',
|
parser.add_argument('release', help='The release to process.',
|
||||||
choices=['juno',
|
choices=get_choices())
|
||||||
'kilo',
|
|
||||||
'liberty',
|
|
||||||
'mitaka',
|
|
||||||
'newton',
|
|
||||||
'ocata',
|
|
||||||
'pike',
|
|
||||||
'queens'])
|
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user