aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2019-05-17 22:00:49 -0600
committerSimon Glass <sjg@chromium.org>2019-07-10 16:52:58 -0600
commite16b7b6c49ff80c8cc2eb53b1f210dc4b743dc90 (patch)
tree67151c11a5619a1768627303f21d94b10bc06acd /tools
parentf3a58c8a7858bfb38456aae7cadecdfbd0f3da98 (diff)
downloadu-boot-e16b7b6c49ff80c8cc2eb53b1f210dc4b743dc90.zip
u-boot-e16b7b6c49ff80c8cc2eb53b1f210dc4b743dc90.tar.gz
u-boot-e16b7b6c49ff80c8cc2eb53b1f210dc4b743dc90.tar.bz2
binman: Update 'text' entry for Python 3
This code reads a binary value and then uses it as a string to look up another value. Add conversions to make this work as expected on Python 3. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/binman/etype/text.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tools/binman/etype/text.py b/tools/binman/etype/text.py
index c4aa510..9ee04d7 100644
--- a/tools/binman/etype/text.py
+++ b/tools/binman/etype/text.py
@@ -7,6 +7,7 @@ from collections import OrderedDict
from entry import Entry, EntryArg
import fdt_util
+import tools
class Entry_text(Entry):
@@ -48,9 +49,11 @@ class Entry_text(Entry):
"""
def __init__(self, section, etype, node):
Entry.__init__(self, section, etype, node)
- self.text_label, = self.GetEntryArgsOrProps(
- [EntryArg('text-label', str)])
- self.value, = self.GetEntryArgsOrProps([EntryArg(self.text_label, str)])
+ label, = self.GetEntryArgsOrProps([EntryArg('text-label', str)])
+ self.text_label = tools.ToStr(label) if type(label) != str else label
+ value, = self.GetEntryArgsOrProps([EntryArg(self.text_label, str)])
+ value = tools.ToBytes(value) if value is not None else value
+ self.value = value
def ObtainContents(self):
if not self.value: