binman: Use items() instead of iteritems()

Python 3 requires this, and Python 2 allows it. Convert the code over to
ensure compatibility with Python 3.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2019-05-14 15:53:41 -06:00
parent 4a4c5dd43f
commit 5097915428
5 changed files with 6 additions and 6 deletions

View file

@ -253,7 +253,7 @@ class Section(object):
""" """
for entry in self._entries.values(): for entry in self._entries.values():
offset_dict = entry.GetOffsets() offset_dict = entry.GetOffsets()
for name, info in offset_dict.iteritems(): for name, info in offset_dict.items():
self._SetEntryOffsetSize(name, *info) self._SetEntryOffsetSize(name, *info)
def PackEntries(self): def PackEntries(self):

View file

@ -131,7 +131,7 @@ def Binman(options, args):
if options.image: if options.image:
skip = [] skip = []
for name, image in images.iteritems(): for name, image in images.items():
if name not in options.image: if name not in options.image:
del images[name] del images[name]
skip.append(name) skip.append(name)

View file

@ -59,7 +59,7 @@ def GetSymbols(fname, patterns):
flags[1] == 'w') flags[1] == 'w')
# Sort dict by address # Sort dict by address
return OrderedDict(sorted(syms.iteritems(), key=lambda x: x[1].address)) return OrderedDict(sorted(syms.items(), key=lambda x: x[1].address))
def GetSymbolAddress(fname, sym_name): def GetSymbolAddress(fname, sym_name):
"""Get a value of a symbol from an ELF file """Get a value of a symbol from an ELF file
@ -98,7 +98,7 @@ def LookupAndWriteSymbols(elf_fname, entry, section):
base = syms.get('__image_copy_start') base = syms.get('__image_copy_start')
if not base: if not base:
return return
for name, sym in syms.iteritems(): for name, sym in syms.items():
if name.startswith('_binman'): if name.startswith('_binman'):
msg = ("Section '%s': Symbol '%s'\n in entry '%s'" % msg = ("Section '%s': Symbol '%s'\n in entry '%s'" %
(section.GetPath(), name, entry.GetPath())) (section.GetPath(), name, entry.GetPath()))

View file

@ -64,7 +64,7 @@ class Entry_gbb(Entry):
self.gbb_flags = 0 self.gbb_flags = 0
flags_node = node.FindNode('flags') flags_node = node.FindNode('flags')
if flags_node: if flags_node:
for flag, value in gbb_flag_properties.iteritems(): for flag, value in gbb_flag_properties.items():
if fdt_util.GetBool(flags_node, flag): if fdt_util.GetBool(flags_node, flag):
self.gbb_flags |= value self.gbb_flags |= value

View file

@ -214,7 +214,7 @@ class TestFunctional(unittest.TestCase):
if verbosity is not None: if verbosity is not None:
args.append('-v%d' % verbosity) args.append('-v%d' % verbosity)
if entry_args: if entry_args:
for arg, value in entry_args.iteritems(): for arg, value in entry_args.items():
args.append('-a%s=%s' % (arg, value)) args.append('-a%s=%s' % (arg, value))
if images: if images:
for image in images: for image in images: