Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH] oe-pkgdata-util: fix AttributeError
@ 2016-06-07 11:59 Ed Bartosh
  0 siblings, 0 replies; only message in thread
From: Ed Bartosh @ 2016-06-07 11:59 UTC (permalink / raw)
  To: openembedded-core

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>
---
 scripts/oe-pkgdata-util | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/oe-pkgdata-util b/scripts/oe-pkgdata-util
index b16ecc9..9b90982 100755
--- a/scripts/oe-pkgdata-util
+++ b/scripts/oe-pkgdata-util
@@ -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',
-- 
2.6.6



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2016-06-07 11:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-07 11:59 [PATCH] oe-pkgdata-util: fix AttributeError Ed Bartosh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox