diff options
author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2016-06-07 14:59:13 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-06-07 21:36:20 +0100 |
commit | db7ec6c1ab8c3c02a82a4aa6ce05b7fa1b0f3c0c (patch) | |
tree | 73f830b5df9d65897f65c2958cf4f259f6d8a1dc | |
parent | 4a842cc95226621326f391705dae7a39bd9e32f7 (diff) | |
download | poky-db7ec6c1ab8c3c02a82a4aa6ce05b7fa1b0f3c0c.tar.gz |
oe-pkgdata-util: fix AttributeError
The default arparse behaviour in Python 2 and early versions of Python 3
was to print usage message if no subcommands provided by user.
In Python >= 3.2.3 subparser has to have attribute 'required' set to
True to behave similar way.
By default subparser.required attribute is set to False, usage message is
not printed and code continues to be executed.
oe-pkgdata-util code raises AttributeError exception in
this case:
AttributeError: 'Namespace' object has no attribute 'func'
Fixed this by setting subparser.required to True.
[YOCTO #9711]
(From OE-Core rev: 207dba5b6eb04c1ae2081bac06724b3b6a198cb3)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-x | scripts/oe-pkgdata-util | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util index b16ecc9e74..9b9098215c 100755 --- a/scripts/oe-pkgdata-util +++ b/scripts/oe-pkgdata-util | |||
@@ -437,6 +437,7 @@ def main(): | |||
437 | parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') | 437 | parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true') |
438 | parser.add_argument('-p', '--pkgdata-dir', help='Path to pkgdata directory (determined automatically if not specified)') | 438 | parser.add_argument('-p', '--pkgdata-dir', help='Path to pkgdata directory (determined automatically if not specified)') |
439 | subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>') | 439 | subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>') |
440 | subparsers.required = True | ||
440 | 441 | ||
441 | parser_lookup_pkg = subparsers.add_parser('lookup-pkg', | 442 | parser_lookup_pkg = subparsers.add_parser('lookup-pkg', |
442 | help='Translate between recipe-space package names and runtime package names', | 443 | help='Translate between recipe-space package names and runtime package names', |