aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorHumberto Ibarra <humberto.ibarra.lopez@intel.com>2016-07-04 15:33:33 -0500
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-07-07 13:38:13 +0100
commit479d15b32691def9de4f4d792ee077168b956635 (patch)
tree383efd36b9bffc403f03710b57425d7422638089 /scripts/lib
parent4ab8650eebce905f6c6eb8fc6f1b042389bc992e (diff)
downloadopenembedded-core-contrib-479d15b32691def9de4f4d792ee077168b956635.tar.gz
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>
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/bsp/engine.py30
1 files changed, 7 insertions, 23 deletions
diff --git a/scripts/lib/bsp/engine.py b/scripts/lib/bsp/engine.py
index 760efc7a60..07a15bb90c 100644
--- a/scripts/lib/bsp/engine.py
+++ b/scripts/lib/bsp/engine.py
@@ -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]
-
- if len(args) < 2 or len(args) > 3:
- return False
-
- if len(args) == 2:
- if args[1] == "properties":
- yocto_layer_list_properties(arch, scripts_path, properties_file)
- else:
- return False
+ return
- if len(args) == 3:
- if args[1] == "property":
- yocto_layer_list_property_values(arch, args[2], scripts_path, properties_file)
- else:
- 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)
- return True
def yocto_layer_list(args, scripts_path, properties_file):