1
0
mirror of https://git.yoctoproject.org/poky synced 2026-07-26 07:07:08 +00:00

wic: Use argparse instead of optparse

* optparse is deprecated and will not be developed further
    (see: https://docs.python.org/2/library/optparse.html)
* argparse supports subcommands, which simplifies definition of
    arguments and options
* reimplement help mechanism through sub-subcommands

[YOCTO #9636]

(From OE-Core rev: 4fe9635c72a6ee1becc47d832ab54724176ee811)

Signed-off-by: Andreas Reichel <andreas.reichel.ext@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Daniel Wagner <daniel.wagner@siemens.com>
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Andreas J. Reichel
2017-04-21 14:11:42 +02:00
committed by Richard Purdie
parent ef506f58da
commit 05aa049e2c
3 changed files with 154 additions and 93 deletions
+6 -5
View File
@@ -201,17 +201,18 @@ def wic_list(args, scripts_path):
"""
Print the list of images or source plugins.
"""
if len(args) < 1:
if args.list_type is None:
return False
if args == ["images"]:
if args.list_type == "images":
list_canned_images(scripts_path)
return True
elif args == ["source-plugins"]:
elif args.list_type == "source-plugins":
list_source_plugins()
return True
elif len(args) == 2 and args[1] == "help":
wks_file = args[0]
elif len(args.help_for) == 1 and args.help_for[0] == 'help':
wks_file = args.list_type
fullpath = find_canned_image(scripts_path, wks_file)
if not fullpath:
raise WicError("No image named %s found, exiting. "