patman: Convert camel case in tools.py
[platform/kernel/u-boot.git] / tools / dtoc / fdt_util.py
index 51bdbdc..19e645d 100644 (file)
@@ -75,12 +75,12 @@ def EnsureCompiled(fname, tmpdir=None, capture_stderr=False):
         dts_input = os.path.join(tmpdir, 'source.dts')
         dtb_output = os.path.join(tmpdir, 'source.dtb')
     else:
-        dts_input = tools.GetOutputFilename('source.dts')
-        dtb_output = tools.GetOutputFilename('source.dtb')
+        dts_input = tools.get_output_filename('source.dts')
+        dtb_output = tools.get_output_filename('source.dtb')
 
     search_paths = [os.path.join(os.getcwd(), 'include')]
     root, _ = os.path.splitext(fname)
-    cc, args = tools.GetTargetCompileTool('cc')
+    cc, args = tools.get_target_compile_tool('cc')
     args += ['-E', '-P', '-x', 'assembler-with-cpp', '-D__ASSEMBLY__']
     args += ['-Ulinux']
     for path in search_paths:
@@ -92,7 +92,7 @@ def EnsureCompiled(fname, tmpdir=None, capture_stderr=False):
     search_list = []
     for path in search_paths:
         search_list.extend(['-i', path])
-    dtc, args = tools.GetTargetCompileTool('dtc')
+    dtc, args = tools.get_target_compile_tool('dtc')
     args += ['-I', 'dts', '-o', dtb_output, '-O', 'dtb',
             '-W', 'no-unit_address_vs_reg']
     args.extend(search_list)
@@ -163,6 +163,27 @@ def GetString(node, propname, default=None):
                          "a single string" % (node.name, propname))
     return value
 
+def GetStringList(node, propname, default=None):
+    """Get a string list from a property
+
+    Args:
+        node (Node): Node object to read from
+        propname (str): property name to read
+        default (list of str): Default value to use if the node/property do not
+            exist, or None
+
+    Returns:
+        String value read, or default if none
+    """
+    prop = node.props.get(propname)
+    if not prop:
+        return default
+    value = prop.value
+    if not isinstance(value, list):
+        strval = GetString(node, propname)
+        return [strval]
+    return value
+
 def GetBool(node, propname, default=False):
     """Get an boolean from a property