From 164ee157bc2d09514c7e2e0a69b011b87a2ee02e Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Mon, 7 Dec 2015 14:16:42 +0100 Subject: [PATCH] [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 --- autogenerate_config_docs/diff_branches.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/autogenerate_config_docs/diff_branches.py b/autogenerate_config_docs/diff_branches.py index fcc7c06d..506722f3 100755 --- a/autogenerate_config_docs/diff_branches.py +++ b/autogenerate_config_docs/diff_branches.py @@ -43,7 +43,7 @@ CODENAME_TITLE = {'ceilometer': 'Telemetry', 'trove': 'Database service'} -def setup_venv(branch, novenvupdate): +def setup_venv(projects, branch, novenvupdate): """Setup a virtual environment for `branch`.""" dirname = os.path.join('venv', branch.replace('/', '_')) if novenvupdate and os.path.exists(dirname): @@ -51,7 +51,7 @@ def setup_venv(branch, novenvupdate): if not os.path.exists('venv'): os.mkdir('venv') args = ["./autohelp-wrapper", "-b", branch, "-e", dirname, "setup"] - args.extend(PROJECTS) + args.extend(projects) if subprocess.call(args) != 0: print("Impossible to create the %s environment." % branch) sys.exit(1) @@ -253,11 +253,15 @@ def get_env(project, new_branch, old_list, new_list): def main(): parser = argparse.ArgumentParser( description='Generate a summary of configuration option changes.', - usage='%(prog)s [options]') + usage='%(prog)s [options] [projects]') parser.add_argument('old_branch', help='Name of the old branch.') parser.add_argument('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', dest='sources', help='Path to a folder containing the git ' @@ -287,15 +291,10 @@ def main(): default=False,) args = parser.parse_args() - # Blacklist trove if we diff between havana and icehouse: autohelp.py fails - # with trove on havana - if args.old_branch == "stable/havana": - PROJECTS.remove('trove') + setup_venv(args.projects, args.old_branch, args.novenvupdate) + setup_venv(args.projects, args.new_branch, args.novenvupdate) - setup_venv(args.old_branch, args.novenvupdate) - setup_venv(args.new_branch, args.novenvupdate) - - for project in PROJECTS: + for project in args.projects: old_list = get_options(project, args.old_branch, args) new_list = get_options(project, args.new_branch, args)