[oe-commits] Ed Bartosh : wic: fix pylint warning redefined-builtin

git at git.openembedded.org git at git.openembedded.org
Wed Sep 2 22:54:22 UTC 2015


Module: openembedded-core.git
Branch: master-next
Commit: bed98142e3e47ac2862ccf8fe3e4bdeabfc91172
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=bed98142e3e47ac2862ccf8fe3e4bdeabfc91172

Author: Ed Bartosh <ed.bartosh at linux.intel.com>
Date:   Wed Sep  2 13:58:14 2015 +0300

wic: fix pylint warning redefined-builtin

Renamed variables named as Python builtin functions.

Signed-off-by: Ed Bartosh <ed.bartosh at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 scripts/lib/wic/engine.py                        | 18 +++++++++---------
 scripts/lib/wic/imager/baseimager.py             |  4 ++--
 scripts/lib/wic/imager/direct.py                 |  6 +++---
 scripts/lib/wic/plugins/source/bootimg-pcbios.py |  6 +++---
 4 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py
index 30c4fa3..d4a7be6 100644
--- a/scripts/lib/wic/engine.py
+++ b/scripts/lib/wic/engine.py
@@ -77,11 +77,11 @@ def find_canned_image(scripts_path, wks_file):
 
     for canned_wks_dir in layers_canned_wks_dir:
         for root, dirs, files in os.walk(canned_wks_dir):
-            for file in files:
-                if file.endswith("~") or file.endswith("#"):
+            for fname in files:
+                if fname.endswith("~") or fname.endswith("#"):
                     continue
-                if file.endswith(".wks") and wks_file + ".wks" == file:
-                    fullpath = os.path.join(canned_wks_dir, file)
+                if fname.endswith(".wks") and wks_file + ".wks" == fname:
+                    fullpath = os.path.join(canned_wks_dir, fname)
                     return fullpath
     return None
 
@@ -94,11 +94,11 @@ def list_canned_images(scripts_path):
 
     for canned_wks_dir in layers_canned_wks_dir:
         for root, dirs, files in os.walk(canned_wks_dir):
-            for file in files:
-                if file.endswith("~") or file.endswith("#"):
+            for fname in files:
+                if fname.endswith("~") or fname.endswith("#"):
                     continue
-                if file.endswith(".wks"):
-                    fullpath = os.path.join(canned_wks_dir, file)
+                if fname.endswith(".wks"):
+                    fullpath = os.path.join(canned_wks_dir, fname)
                     f = open(fullpath, "r")
                     lines = f.readlines()
                     for line in lines:
@@ -107,7 +107,7 @@ def list_canned_images(scripts_path):
                         if idx != -1:
                             desc = line[idx + len("short-description:"):].strip()
                             break
-                    basename = os.path.splitext(file)[0]
+                    basename = os.path.splitext(fname)[0]
                     print "  %s\t\t%s" % (basename.ljust(30), desc)
 
 
diff --git a/scripts/lib/wic/imager/baseimager.py b/scripts/lib/wic/imager/baseimager.py
index 4abcabc..acbe948 100644
--- a/scripts/lib/wic/imager/baseimager.py
+++ b/scripts/lib/wic/imager/baseimager.py
@@ -186,7 +186,7 @@ class BaseImageCreator(object):
     def print_outimage_info(self):
         msg = "The new image can be found here:\n"
         self.outimage.sort()
-        for file in self.outimage:
-            msg += '  %s\n' % os.path.abspath(file)
+        for path in self.outimage:
+            msg += '  %s\n' % os.path.abspath(path)
 
         msger.info(msg)
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py
index 74ebbe7..761e436 100644
--- a/scripts/lib/wic/imager/direct.py
+++ b/scripts/lib/wic/imager/direct.py
@@ -340,10 +340,10 @@ class DirectImageCreator(BaseImageCreator):
             if p.get_rootfs() is None:
                 continue
             if p.mountpoint == '/':
-                str = ':'
+                suffix = ':'
             else:
-                str = '["%s"]:' % (p.mountpoint or p.label)
-            msg += '  ROOTFS_DIR%s%s\n' % (str.ljust(20), p.get_rootfs())
+                suffix = '["%s"]:' % (p.mountpoint or p.label)
+            msg += '  ROOTFS_DIR%s%s\n' % (suffix.ljust(20), p.get_rootfs())
 
         msg += '  BOOTIMG_DIR:                  %s\n' % self.bootimg_dir
         msg += '  KERNEL_DIR:                   %s\n' % self.kernel_dir
diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
index 721c524..3c2dbc9 100644
--- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -127,9 +127,9 @@ class BootimgPcbiosPlugin(SourcePlugin):
         'prepares' the partition to be incorporated into the image.
         In this case, prepare content for legacy bios boot partition.
         """
-        def _has_syslinux(dir):
-            if dir:
-                syslinux = "%s/syslinux" % dir
+        def _has_syslinux(dirname):
+            if dirname:
+                syslinux = "%s/syslinux" % dirname
                 if os.path.exists(syslinux):
                     return True
             return False



More information about the Openembedded-commits mailing list