summaryrefslogtreecommitdiffstats
path: root/scripts/lib/bsp
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/bsp
parent4ab8650eebce905f6c6eb8fc6f1b042389bc992e (diff)
downloadpoky-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/bsp')
-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
1826 print_values(type, values_list) 1826 print_values(type, values_list)
1827 1827
1828 1828
1829def yocto_bsp_list(args, scripts_path, properties_file): 1829def yocto_bsp_list(args, scripts_path):
1830 """ 1830 """
1831 Print available architectures, or the complete list of properties 1831 Print available architectures, or the complete list of properties
1832 defined by the BSP, or the possible values for a particular BSP 1832 defined by the BSP, or the possible values for a particular BSP
1833 property. 1833 property.
1834 """ 1834 """
1835 if len(args) < 1: 1835 if args.karch == "karch":
1836 return False
1837
1838 if args[0] == "karch":
1839 lib_path = scripts_path + '/lib' 1836 lib_path = scripts_path + '/lib'
1840 bsp_path = lib_path + '/bsp' 1837 bsp_path = lib_path + '/bsp'
1841 arch_path = bsp_path + '/substrate/target/arch' 1838 arch_path = bsp_path + '/substrate/target/arch'
@@ -1844,26 +1841,13 @@ def yocto_bsp_list(args, scripts_path, properties_file):
1844 if arch == "common" or arch == "layer": 1841 if arch == "common" or arch == "layer":
1845 continue 1842 continue
1846 print(" %s" % arch) 1843 print(" %s" % arch)
1847 return True 1844 return
1848 else:
1849 arch = args[0]
1850
1851 if len(args) < 2 or len(args) > 3:
1852 return False
1853
1854 if len(args) == 2:
1855 if args[1] == "properties":
1856 yocto_layer_list_properties(arch, scripts_path, properties_file)
1857 else:
1858 return False
1859 1845
1860 if len(args) == 3: 1846 if args.properties:
1861 if args[1] == "property": 1847 yocto_layer_list_properties(args.karch, scripts_path, args.properties_file)
1862 yocto_layer_list_property_values(arch, args[2], scripts_path, properties_file) 1848 elif args.property:
1863 else: 1849 yocto_layer_list_property_values(args.karch, args.property, scripts_path, args.properties_file)
1864 return False
1865 1850
1866 return True
1867 1851
1868 1852
1869def yocto_layer_list(args, scripts_path, properties_file): 1853def yocto_layer_list(args, scripts_path, properties_file):