From ef68d67f584dd86e44f1bf77300c73ea47b1b626 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mar 03 2016 09:24:37 +0000 Subject: cli.py: more cleanups (and fix a logic error) the check that either url or compose and milestone are set for compose creation was broken, fixed now. Other stuff is cosmetic. --- diff --git a/relval/cli.py b/relval/cli.py index a5029db..b0fb602 100755 --- a/relval/cli.py +++ b/relval/cli.py @@ -139,8 +139,8 @@ def parse_args(): "be specified more than once, all pages matching ANY " "specified keyword will be included") - # See the argparse instructions for all of this. Use of 'metavar' avoids - # the entire ranges of valid values being shown in the help. + # See the argparse instructions for all of this. Use of 'metavar' + # avoids the entire ranges of valid values being shown in the help parser = argparse.ArgumentParser( description=( "Tool for various tasks related to Fedora release validation " @@ -154,8 +154,8 @@ def parse_args(): "For commands which require logging in to the wiki, you can " "specify a user name with --username. If you do not, relval will " "attempt to use your system account user name.\n\n For unattended " - "operation you can create a file ~/.fedora/credentials, containing " - "one user name and one password per line, separated by a space " + "operation you can create a file ~/.fedora/credentials, containing" + " one user name and one password per line, separated by a space " "(and readable only by your own user!). If you pass --username " "and specify a user listed in the credentials file, the password " "found in the file will be used. If a credentials file exists and " @@ -181,8 +181,8 @@ def parse_args(): "setting will be ignored. This command requires login; see main help " "information about user name and password.") parser_compose.add_argument( - '-r', '--release', help=release_help, type=int, metavar="22-99", - choices=list(range(22, 100))) + '-r', '--release', help=release_help, type=int, metavar="24-99", + choices=list(range(24, 100))) parser_compose.add_argument( '-m', '--milestone', help=milestone_help, choices=['Alpha', 'Beta', 'Final', 'Branched', 'Rawhide']) @@ -213,8 +213,8 @@ def parse_args(): "were run and bugs reported by each individual tester for a set of " "test events.") parser_userstats.add_argument( - '-r', '--release', help=release_help, type=int, choices=list(range(12, 100)), - metavar="12-99") + '-r', '--release', help=release_help, type=int, metavar="12-99", + choices=list(range(12, 100))) parser_userstats.add_argument( '-m', '--milestone', help=milestone_help_specific, choices=['Alpha', 'Beta', 'Final']) @@ -232,8 +232,8 @@ def parse_args(): "tables providing an overview of test coverage across a series of " "test events.") parser_tcstats.add_argument( - '-r', '--release', help=release_help, type=int, choices=list(range(12, 100)), - metavar="12-99") + '-r', '--release', help=release_help, type=int, metavar="12-99", + choices=list(range(12, 100))) parser_tcstats.add_argument( '-m', '--milestone', help=milestone_help_specific, choices=['Alpha', 'Beta', 'Final']) @@ -257,8 +257,8 @@ def parse_args(): parser_result.add_argument( '-u', '--username', help=username_help) parser_result.add_argument( - '-r', '--release', help=release_help, type=int, choices=list(range(12, 100)), - metavar="12-99") + '-r', '--release', help=release_help, type=int, metavar="12-99", + choices=list(range(12, 100))) parser_result.add_argument( '-m', '--milestone', help=milestone_help, choices=['Alpha', 'Beta', 'Final', 'Branched', 'Rawhide']) @@ -299,7 +299,7 @@ def parse_args(): site = setup_site(args, creds) # guessrel is kinda ugly, but some sub-functions don't want release # guessing - if args.guessrel and not args.release and (not hasattr(args, 'url') or not args.url): + if args.guessrel and not args.release and not getattr(args, 'url', ''): args.release = guess_release(site) return (args, site) @@ -314,7 +314,7 @@ def create_compose(args, site): if args.url: event = site.get_validation_event_url(args.url) else: - if not args.milestone and args.compose: + if not args.milestone or not args.compose: sys.exit("You must specify --url or both --milestone " "and --compose!") event = site.get_validation_event(