]> code.ossystems Code Review - openembedded-core.git/commitdiff
wic: code cleanup
authorEd Bartosh <ed.bartosh@linux.intel.com>
Fri, 16 Jun 2017 13:19:29 +0000 (16:19 +0300)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 23 Jun 2017 10:43:37 +0000 (11:43 +0100)
Split long lines.
Removed unused imports.

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
scripts/lib/wic/filemap.py
scripts/lib/wic/misc.py
scripts/lib/wic/partition.py
scripts/lib/wic/pluginbase.py
scripts/lib/wic/plugins/source/rootfs.py

index 6d11355a1844cc5c1cde16d0668a5dfe68697beb..77e32b9addbda4259eeec55127a05e200d4b776c 100644 (file)
@@ -34,13 +34,9 @@ def get_block_size(file_obj):
     Returns block size for file object 'file_obj'. Errors are indicated by the
     'IOError' exception.
     """
-
-    from fcntl import ioctl
-    import struct
-
     # Get the block size of the host file-system for the image file by calling
     # the FIGETBSZ ioctl (number 2).
-    binary_data = ioctl(file_obj, 2, struct.pack('I', 0))
+    binary_data = fcntl.ioctl(file_obj, 2, struct.pack('I', 0))
     return struct.unpack('I', binary_data)[0]
 
 class ErrorNotSupp(Exception):
@@ -228,7 +224,7 @@ class FilemapSeek(_FilemapBase):
         try:
             tmp_obj = tempfile.TemporaryFile("w+", dir=directory)
         except IOError as err:
-            raise ErrorNotSupp("cannot create a temporary in \"%s\": %s"
+            raise ErrorNotSupp("cannot create a temporary in \"%s\": %s" \
                               % (directory, err))
 
         try:
index 46099840ca4a2b52339c5843e6634daa89d0d82d..8a38f2f479979b45906fb08ce612494d0f9f81eb 100644 (file)
@@ -131,8 +131,8 @@ def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""):
               "was not found (see details above).\n\n" % prog
         recipe = NATIVE_RECIPES.get(prog)
         if recipe:
-            msg += "Please make sure wic-tools have %s-native in its DEPENDS, bake it with 'bitbake wic-tools' "\
-                   "and try again.\n" % recipe
+            msg += "Please make sure wic-tools have %s-native in its DEPENDS, "\
+                   "build it with 'bitbake wic-tools' and try again.\n" % recipe
         else:
             msg += "Wic failed to find a recipe to build native %s. Please "\
                    "file a bug against wic.\n" % prog
index 1851c4a3a5914da46d49cebeafc5c9ecc139b439..5aa68c93c12180dbae1476c70eba613c1efc534d 100644 (file)
@@ -26,7 +26,6 @@
 
 import logging
 import os
-import tempfile
 
 from wic import WicError
 from wic.misc import exec_cmd, exec_native_cmd, get_bitbake_var
index 08f9979f3ca1728091d67dbb65bb2cadaf6c351b..c009820adccd665a5d63edb7f94a33aa4762ea08 100644 (file)
@@ -137,4 +137,3 @@ class SourcePlugin(metaclass=PluginMeta):
         'prepares' the partition to be incorporated into the image.
         """
         logger.debug("SourcePlugin: do_prepare_partition: part: %s", part)
-
index 1b9f68b8740b42829c7187491d7b6c718d82c1b1..4dc4cb851de13a210fe72659a64443e3cb14213f 100644 (file)
@@ -34,7 +34,7 @@ from oe.path import copyhardlinktree
 
 from wic import WicError
 from wic.pluginbase import SourcePlugin
-from wic.misc import get_bitbake_var, exec_cmd
+from wic.misc import get_bitbake_var
 
 logger = logging.getLogger('wic')