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>
This commit is contained in:
@@ -7,6 +7,7 @@ from collections import OrderedDict
|
|||||||
|
|
||||||
from entry import Entry, EntryArg
|
from entry import Entry, EntryArg
|
||||||
import fdt_util
|
import fdt_util
|
||||||
|
import tools
|
||||||
|
|
||||||
|
|
||||||
class Entry_text(Entry):
|
class Entry_text(Entry):
|
||||||
@@ -48,9 +49,11 @@ class Entry_text(Entry):
|
|||||||
"""
|
"""
|
||||||
def __init__(self, section, etype, node):
|
def __init__(self, section, etype, node):
|
||||||
Entry.__init__(self, section, etype, node)
|
Entry.__init__(self, section, etype, node)
|
||||||
self.text_label, = self.GetEntryArgsOrProps(
|
label, = self.GetEntryArgsOrProps([EntryArg('text-label', str)])
|
||||||
[EntryArg('text-label', str)])
|
self.text_label = tools.ToStr(label) if type(label) != str else label
|
||||||
self.value, = self.GetEntryArgsOrProps([EntryArg(self.text_label, str)])
|
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):
|
def ObtainContents(self):
|
||||||
if not self.value:
|
if not self.value:
|
||||||
|
Reference in New Issue
Block a user