]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic: use next builtin instead of .next method
authorEd Bartosh <ed.bartosh@linux.intel.com>
Wed, 4 May 2016 13:06:27 +0000 (16:06 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Sat, 14 May 2016 06:26:43 +0000 (07:26 +0100)
Generators in Python 3 don't have .next method. It's recommended
to use 'next' builtin instead. As it also present in Python >= 2.6
it should make wic code compatible with both Python 2 and Python 3.

[YOCTO #9412]

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/lib/wic/filemap.py
scripts/lib/wic/msger.py

index 2778be5e1b5ce62f5768551754097c4dedf00f99..f3240ba8d870bf9e99d21cdc2c094551ee1c5bd1 100644 (file)
@@ -482,7 +482,7 @@ class FilemapFiemap(_FilemapBase):
         self._log.debug("FilemapFiemap: get_mapped_ranges(%d,  %d(%d))"
                         % (start, count, start + count - 1))
         iterator = self._do_get_mapped_ranges(start, count)
-        first_prev, last_prev = iterator.next()
+        first_prev, last_prev = next(iterator)
 
         for first, last in iterator:
             if last_prev == first - 1:
index 4d8e704172fcead87d6b1f16874a334eacba4b52..fb8336d94ae2d1e9504c3a67e411cd295a796f7f 100644 (file)
@@ -148,7 +148,7 @@ def _split_msg(head, msg):
     return head, msg
 
 def get_loglevel():
-    return (k for k, v in LOG_LEVELS.items() if v == LOG_LEVEL).next()
+    return next((k for k, v in LOG_LEVELS.items() if v == LOG_LEVEL))
 
 def set_loglevel(level):
     global LOG_LEVEL