[U-Boot] [PATCH 07/24] dtoc: Convert the Fdt.Prop class to Python 3

Simon Glass sjg at chromium.org
Sat May 18 04:00:37 UTC 2019


Update this class to work correctly on Python 3 and to pass its unit
tests.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 tools/dtoc/fdt.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py
index cbd9cbabe31..f051ce67632 100644
--- a/tools/dtoc/fdt.py
+++ b/tools/dtoc/fdt.py
@@ -98,18 +98,18 @@ class Prop:
             bytes
         type: Value type
     """
-    def __init__(self, node, offset, name, bytes):
+    def __init__(self, node, offset, name, data):
         self._node = node
         self._offset = offset
         self.name = name
         self.value = None
-        self.bytes = str(bytes)
+        self.bytes = bytes(data)
         self.dirty = False
-        if not bytes:
+        if not data:
             self.type = TYPE_BOOL
             self.value = True
             return
-        self.type, self.value = BytesToValue(bytes)
+        self.type, self.value = BytesToValue(bytes(data))
 
     def RefreshOffset(self, poffset):
         self._offset = poffset
-- 
2.21.0.1020.gf2820cf01a-goog



More information about the U-Boot mailing list