1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-13 17:10:01 +00:00

yocto-bsp: Refactor script to use argparse instead of optparse

Optparse is deprecated and should be avoided. The arparse library is better suited and has more tools to handling the parsing of arguments. This patch makes necessary changes to migrate to the better library and uses arparse subcommand feature to improve organization of this script.

[YOCTO #8321]

(From meta-yocto rev: 3f45993b96d4d960da0efe8672dc323c9db091a2)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Humberto Ibarra
2016-07-04 15:33:33 -05:00
committed by Richard Purdie
parent 4ab8650eeb
commit 479d15b326
2 changed files with 78 additions and 84 deletions
+7 -23
View File
@@ -1826,16 +1826,13 @@ def yocto_layer_list_property_values(arch, property, scripts_path, properties_fi
print_values(type, values_list)
def yocto_bsp_list(args, scripts_path, properties_file):
def yocto_bsp_list(args, scripts_path):
"""
Print available architectures, or the complete list of properties
defined by the BSP, or the possible values for a particular BSP
property.
"""
if len(args) < 1:
return False
if args[0] == "karch":
if args.karch == "karch":
lib_path = scripts_path + '/lib'
bsp_path = lib_path + '/bsp'
arch_path = bsp_path + '/substrate/target/arch'
@@ -1844,26 +1841,13 @@ def yocto_bsp_list(args, scripts_path, properties_file):
if arch == "common" or arch == "layer":
continue
print(" %s" % arch)
return True
else:
arch = args[0]
return
if len(args) < 2 or len(args) > 3:
return False
if args.properties:
yocto_layer_list_properties(args.karch, scripts_path, args.properties_file)
elif args.property:
yocto_layer_list_property_values(args.karch, args.property, scripts_path, args.properties_file)
if len(args) == 2:
if args[1] == "properties":
yocto_layer_list_properties(arch, scripts_path, properties_file)
else:
return False
if len(args) == 3:
if args[1] == "property":
yocto_layer_list_property_values(arch, args[2], scripts_path, properties_file)
else:
return False
return True
def yocto_layer_list(args, scripts_path, properties_file):