binman: Use items() instead of iteritems()
authorSimon Glass <sjg@chromium.org>
Tue, 14 May 2019 21:53:41 +0000 (15:53 -0600)
committerSimon Glass <sjg@chromium.org>
Wed, 10 Jul 2019 22:52:45 +0000 (16:52 -0600)
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>
tools/binman/bsection.py
tools/binman/control.py
tools/binman/elf.py
tools/binman/etype/gbb.py
tools/binman/ftest.py

index be67ff957e783879b71c66a33e451339b9fedbcd..3ca0592fe1a2cdcd55c5a344d1a9eb64424c86ab 100644 (file)
@@ -253,7 +253,7 @@ class Section(object):
         """
         for entry in self._entries.values():
             offset_dict = entry.GetOffsets()
-            for name, info in offset_dict.iteritems():
+            for name, info in offset_dict.items():
                 self._SetEntryOffsetSize(name, *info)
 
     def PackEntries(self):
index 8f7f9068604f0f6077cb357940b1630d5956d737..ce25eb5485860614942dfb822a2aa1f12eef1860 100644 (file)
@@ -131,7 +131,7 @@ def Binman(options, args):
 
             if options.image:
                 skip = []
-                for name, image in images.iteritems():
+                for name, image in images.items():
                     if name not in options.image:
                         del images[name]
                         skip.append(name)
index 97df8e32c5d8d60271051874c4b81a53b16914c7..828681d76d0d2b1258f139e5d523c5a1d7cf4ae1 100644 (file)
@@ -59,7 +59,7 @@ def GetSymbols(fname, patterns):
                                 flags[1] == 'w')
 
     # 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):
     """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')
     if not base:
         return
-    for name, sym in syms.iteritems():
+    for name, sym in syms.items():
         if name.startswith('_binman'):
             msg = ("Section '%s': Symbol '%s'\n   in entry '%s'" %
                    (section.GetPath(), name, entry.GetPath()))
index 8fe10f47135bebe6a6761e2cb15f1bcc0b10d4ac..a94c0fca9d5368c2df69b14e94fc44da58abaa88 100644 (file)
@@ -64,7 +64,7 @@ class Entry_gbb(Entry):
         self.gbb_flags = 0
         flags_node = node.FindNode('flags')
         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):
                     self.gbb_flags |= value
 
index daea1ea138229056629dd4b4b32d58892c846a4a..7cf17526a73bc8901921c2043600d1cf8731db7f 100644 (file)
@@ -214,7 +214,7 @@ class TestFunctional(unittest.TestCase):
         if verbosity is not None:
             args.append('-v%d' % verbosity)
         if entry_args:
-            for arg, value in entry_args.iteritems():
+            for arg, value in entry_args.items():
                 args.append('-a%s=%s' % (arg, value))
         if images:
             for image in images: