Bug 1547730 - Do six.itervalues instead of dict.itervalues r=glandium
authorJustin Wood <Callek@gmail.com>
Tue, 28 May 2019 14:23:54 +0000
changeset 475892 66933913a2dfe148b6770940d100f71ad0c87c99
parent 475891 abbfe68afc04cd4473f152f75b4f65e8a5d5dc69
child 475893 1e4407c3c9e307af9ca79295ff224939039ff2c3
push id86529
push userjwood@mozilla.com
push dateTue, 28 May 2019 14:47:17 +0000
treeherderautoland@dbadda4e3c1c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1547730
milestone69.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1547730 - Do six.itervalues instead of dict.itervalues r=glandium Differential Revision: https://phabricator.services.mozilla.com/D28104
python/mozbuild/mozbuild/configure/__init__.py
python/mozbuild/mozbuild/configure/options.py
python/mozbuild/mozpack/mozjar.py
--- a/python/mozbuild/mozbuild/configure/__init__.py
+++ b/python/mozbuild/mozbuild/configure/__init__.py
@@ -430,17 +430,17 @@ class ConfigureSandbox(dict):
 
     def run(self, path=None):
         '''Executes the given file within the sandbox, as well as everything
         pending from any other included file, and ensure the overall
         consistency of the executed script(s).'''
         if path:
             self.include_file(path)
 
-        for option in self._options.itervalues():
+        for option in six.itervalues(self._options):
             # All options must be referenced by some @depends function
             if option not in self._seen:
                 raise ConfigureError(
                     'Option `%s` is not handled ; reference it with a @depends'
                     % option.option
                 )
 
             self._value_for(option)
--- a/python/mozbuild/mozbuild/configure/options.py
+++ b/python/mozbuild/mozbuild/configure/options.py
@@ -514,10 +514,10 @@ class CommandLineHelper(object):
                 "Cannot add '{arg}' to the {origin} set because it conflicts "
                 "with {old_arg} from the {old_origin} set", arg=extra_arg,
                 origin=extra_ret.origin, old_arg=arg, old_origin=ret.origin)
 
         return extra_ret, extra_arg
 
     def __iter__(self):
         for d in (self._args, self._extra_args):
-            for arg, pos in d.itervalues():
+            for arg, pos in six.itervalues(d):
                 yield arg
--- a/python/mozbuild/mozpack/mozjar.py
+++ b/python/mozbuild/mozpack/mozjar.py
@@ -70,17 +70,17 @@ class JarStruct(object):
     TYPE_MAPPING = {'uint32': ('I', 4), 'uint16': ('H', 2)}
 
     def __init__(self, data=None):
         '''
         Create an instance from the given data. Data may be omitted to create
         an instance with empty fields.
         '''
         assert self.MAGIC and isinstance(self.STRUCT, OrderedDict)
-        self.size_fields = set(t for t in self.STRUCT.itervalues()
+        self.size_fields = set(t for t in six.itervalues(self.STRUCT)
                                if t not in JarStruct.TYPE_MAPPING)
         self._values = {}
         if data:
             self._init_data(data)
         else:
             self._init_empty()
 
     def _init_data(self, data):
@@ -376,17 +376,17 @@ class JarReader(object):
         '''
         del self._data
 
     @property
     def compression(self):
         entries = self.entries
         if not entries:
             return JAR_STORED
-        return max(f['compression'] for f in entries.itervalues())
+        return max(f['compression'] for f in six.itervalues(entries))
 
     @property
     def entries(self):
         '''
         Return an ordered dict of central directory entries, indexed by
         filename, in the order they appear in the Jar archive central
         directory. Directory entries are skipped.
         '''
@@ -454,17 +454,17 @@ class JarReader(object):
 
     def __iter__(self):
         '''
         Iterate over all files in the Jar archive, in the form of
         JarFileReaders.
             for file in jarReader:
                 ...
         '''
-        for entry in self.entries.itervalues():
+        for entry in six.itervalues(self.entries):
             yield self._getreader(entry)
 
     def __getitem__(self, name):
         '''
         Get a JarFileReader for the given file name.
         '''
         return self._getreader(self.entries[name])
 
@@ -548,17 +548,17 @@ class JarWriter(object):
         The duplication of the End of central directory is to accomodate some
         Zip reading tools that want an end of central directory structure to
         follow the central directory entries.
         '''
         offset = 0
         headers = {}
         preload_size = 0
         # Prepare central directory entries
-        for entry, content in self._contents.itervalues():
+        for entry, content in six.itervalues(self._contents):
             header = JarLocalFileHeader()
             for name in entry.STRUCT:
                 if name in header:
                     header[name] = entry[name]
             entry['offset'] = offset
             offset += len(content) + header.size
             if entry['filename'] == self._last_preloaded:
                 preload_size = offset
@@ -571,28 +571,28 @@ class JarWriter(object):
                                   self._contents.values(), 0)
         # On optimized archives, store the preloaded size and the central
         # directory entries, followed by the first end of central directory.
         if preload_size:
             end['cdir_offset'] = 4
             offset = end['cdir_size'] + end['cdir_offset'] + end.size
             preload_size += offset
             self._data.write(struct.pack('<I', preload_size))
-            for entry, _ in self._contents.itervalues():
+            for entry, _ in six.itervalues(self._contents):
                 entry['offset'] += offset
                 self._data.write(entry.serialize())
             self._data.write(end.serialize())
         # Store local file entries followed by compressed data
-        for entry, content in self._contents.itervalues():
+        for entry, content in six.itervalues(self._contents):
             self._data.write(headers[entry].serialize())
             self._data.write(content)
         # On non optimized archives, store the central directory entries.
         if not preload_size:
             end['cdir_offset'] = offset
-            for entry, _ in self._contents.itervalues():
+            for entry, _ in six.itervalues(self._contents):
                 self._data.write(entry.serialize())
         # Store the end of central directory.
         self._data.write(end.serialize())
         self._data.close()
 
     def add(self, name, data, compress=None, mode=None, skip_duplicates=False):
         '''
         Add a new member to the jar archive, with the given name and the given