[diff_branches] Projects can be passed as arguments

The list of projects being worked on by the script was hardcoded. This
patch adds the possibility to pass the list of projects to work on as
arguments on the command line.

Remove a project-list-related special case for trove on havana.

Change-Id: I7eb282fe9050a9c9367ee1ad72d9adbf6db29063
This commit is contained in:
Gauvain Pocentek 2015-12-07 14:16:42 +01:00
parent 254893c8fd
commit 164ee157bc
1 changed files with 10 additions and 11 deletions

View File

@ -43,7 +43,7 @@ CODENAME_TITLE = {'ceilometer': 'Telemetry',
'trove': 'Database service'} 'trove': 'Database service'}
def setup_venv(branch, novenvupdate): def setup_venv(projects, branch, novenvupdate):
"""Setup a virtual environment for `branch`.""" """Setup a virtual environment for `branch`."""
dirname = os.path.join('venv', branch.replace('/', '_')) dirname = os.path.join('venv', branch.replace('/', '_'))
if novenvupdate and os.path.exists(dirname): if novenvupdate and os.path.exists(dirname):
@ -51,7 +51,7 @@ def setup_venv(branch, novenvupdate):
if not os.path.exists('venv'): if not os.path.exists('venv'):
os.mkdir('venv') os.mkdir('venv')
args = ["./autohelp-wrapper", "-b", branch, "-e", dirname, "setup"] args = ["./autohelp-wrapper", "-b", branch, "-e", dirname, "setup"]
args.extend(PROJECTS) args.extend(projects)
if subprocess.call(args) != 0: if subprocess.call(args) != 0:
print("Impossible to create the %s environment." % branch) print("Impossible to create the %s environment." % branch)
sys.exit(1) sys.exit(1)
@ -253,11 +253,15 @@ def get_env(project, new_branch, old_list, new_list):
def main(): def main():
parser = argparse.ArgumentParser( parser = argparse.ArgumentParser(
description='Generate a summary of configuration option changes.', description='Generate a summary of configuration option changes.',
usage='%(prog)s <old_branch> <new_branch> [options]') usage='%(prog)s [options] <old_branch> <new_branch> [projects]')
parser.add_argument('old_branch', parser.add_argument('old_branch',
help='Name of the old branch.') help='Name of the old branch.')
parser.add_argument('new_branch', parser.add_argument('new_branch',
help='Name of the new branch.') help='Name of the new branch.')
parser.add_argument('projects',
help='List of projects to work on.',
nargs='*',
default=PROJECTS)
parser.add_argument('-i', '--input', parser.add_argument('-i', '--input',
dest='sources', dest='sources',
help='Path to a folder containing the git ' help='Path to a folder containing the git '
@ -287,15 +291,10 @@ def main():
default=False,) default=False,)
args = parser.parse_args() args = parser.parse_args()
# Blacklist trove if we diff between havana and icehouse: autohelp.py fails setup_venv(args.projects, args.old_branch, args.novenvupdate)
# with trove on havana setup_venv(args.projects, args.new_branch, args.novenvupdate)
if args.old_branch == "stable/havana":
PROJECTS.remove('trove')
setup_venv(args.old_branch, args.novenvupdate) for project in args.projects:
setup_venv(args.new_branch, args.novenvupdate)
for project in PROJECTS:
old_list = get_options(project, args.old_branch, args) old_list = get_options(project, args.old_branch, args)
new_list = get_options(project, args.new_branch, args) new_list = get_options(project, args.new_branch, args)