From b41b2fa4dd69fdc8946bfa1d2cb4a20b68435ddc Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Mon, 13 Jun 2016 16:43:41 +1200 Subject: scripts: ensure not specifying subcommand shows help text With Python 2, argparse subparsers behaviour in Python 2 was to print the usage information if the subparsers argument wasn't specified. However, with Python 3.2.3 and later a subparsers argument is not required by default, leading to errors when no arguments are specified: AttributeError: 'Namespace' object has no attribute 'func' Restore the previous desired behaviour of showing the help text for devtool, recipetool and the devtool-stress script by setting subparsers.required to True. (From OE-Core rev: d36fdea1a7f32d97187e0e9e6d701ae8fa304e8f) Signed-off-by: Paul Eggleton Signed-off-by: Richard Purdie --- scripts/recipetool | 1 + 1 file changed, 1 insertion(+) (limited to 'scripts/recipetool') diff --git a/scripts/recipetool b/scripts/recipetool index 0e8bffb5c0..17233d4ef0 100755 --- a/scripts/recipetool +++ b/scripts/recipetool @@ -60,6 +60,7 @@ def main(): parser.add_argument('-h', '--help', action='help', default=argparse.SUPPRESS, help='show this help message and exit') subparsers = parser.add_subparsers(title='subcommands', metavar='') + subparsers.required = True if global_args.debug: logger.setLevel(logging.DEBUG) -- cgit v1.2.3-54-g00ecf