diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2016-06-13 16:43:41 +1200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-06-15 08:35:01 +0100 |
commit | b41b2fa4dd69fdc8946bfa1d2cb4a20b68435ddc (patch) | |
tree | ef03f21aafa4380e29bf83d89511b52377fe5391 /scripts/devtool | |
parent | 5c1b9fd54158bea702b6a0354948b00089975bda (diff) | |
download | poky-b41b2fa4dd69fdc8946bfa1d2cb4a20b68435ddc.tar.gz |
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 <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/devtool')
-rwxr-xr-x | scripts/devtool | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/scripts/devtool b/scripts/devtool index 63d2ef9053..a93a11f341 100755 --- a/scripts/devtool +++ b/scripts/devtool | |||
@@ -301,6 +301,7 @@ def main(): | |||
301 | tinfoil.shutdown() | 301 | tinfoil.shutdown() |
302 | 302 | ||
303 | subparsers = parser.add_subparsers(dest="subparser_name", title='subcommands', metavar='<subcommand>') | 303 | subparsers = parser.add_subparsers(dest="subparser_name", title='subcommands', metavar='<subcommand>') |
304 | subparsers.required = True | ||
304 | 305 | ||
305 | subparsers.add_subparser_group('sdk', 'SDK maintenance', -2) | 306 | subparsers.add_subparser_group('sdk', 'SDK maintenance', -2) |
306 | subparsers.add_subparser_group('advanced', 'Advanced', -1) | 307 | subparsers.add_subparser_group('advanced', 'Advanced', -1) |