summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic/engine.py
diff options
context:
space:
mode:
authorAndreas J. Reichel <andreas.reichel@tngtech.com>2017-04-21 14:11:42 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-05-23 17:45:35 +0100
commit05aa049e2c314731385e1d18b5fd6e1f1e63ea8f (patch)
tree52fdc4d1356ed6106ca1d653b56fbae632129734 /scripts/lib/wic/engine.py
parentef506f58da3a95fba2696df749b2b81f9c118847 (diff)
downloadpoky-05aa049e2c314731385e1d18b5fd6e1f1e63ea8f.tar.gz
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>
Diffstat (limited to 'scripts/lib/wic/engine.py')
-rw-r--r--scripts/lib/wic/engine.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index f59821fea6..647358287f 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -201,17 +201,18 @@ def wic_list(args, scripts_path):
201 """ 201 """
202 Print the list of images or source plugins. 202 Print the list of images or source plugins.
203 """ 203 """
204 if len(args) < 1: 204 if args.list_type is None:
205 return False 205 return False
206 206
207 if args == ["images"]: 207 if args.list_type == "images":
208
208 list_canned_images(scripts_path) 209 list_canned_images(scripts_path)
209 return True 210 return True
210 elif args == ["source-plugins"]: 211 elif args.list_type == "source-plugins":
211 list_source_plugins() 212 list_source_plugins()
212 return True 213 return True
213 elif len(args) == 2 and args[1] == "help": 214 elif len(args.help_for) == 1 and args.help_for[0] == 'help':
214 wks_file = args[0] 215 wks_file = args.list_type
215 fullpath = find_canned_image(scripts_path, wks_file) 216 fullpath = find_canned_image(scripts_path, wks_file)
216 if not fullpath: 217 if not fullpath:
217 raise WicError("No image named %s found, exiting. " 218 raise WicError("No image named %s found, exiting. "