]> code.ossystems Code Review - openembedded-core.git/commitdiff
oe-pkgdata-util: fix AttributeError
authorEd Bartosh <ed.bartosh@linux.intel.com>
Tue, 7 Jun 2016 11:59:13 +0000 (14:59 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 7 Jun 2016 20:36:09 +0000 (21:36 +0100)
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]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/oe-pkgdata-util

index b16ecc9e7480e2e98d1399e06f09481d2da2bb9d..9b9098215c9e6637f469dd5f31d73952cd9679bc 100755 (executable)
@@ -437,6 +437,7 @@ def main():
     parser.add_argument('-d', '--debug', help='Enable debug output', action='store_true')
     parser.add_argument('-p', '--pkgdata-dir', help='Path to pkgdata directory (determined automatically if not specified)')
     subparsers = parser.add_subparsers(title='subcommands', metavar='<subcommand>')
+    subparsers.required = True
 
     parser_lookup_pkg = subparsers.add_parser('lookup-pkg',
                                           help='Translate between recipe-space package names and runtime package names',