diff options
| author | Ed Bartosh <ed.bartosh@linux.intel.com> | 2017-06-16 16:19:29 +0300 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-06-23 11:44:12 +0100 |
| commit | 247b7a8c3aee8a1a3e28e196aaad964c4598edb6 (patch) | |
| tree | 89a79af7920b2cf2a0280158e80edad63a104959 /scripts/lib | |
| parent | dd7e0ae43d84eefb5cc0155656f5d540e01944fb (diff) | |
| download | poky-247b7a8c3aee8a1a3e28e196aaad964c4598edb6.tar.gz | |
wic: code cleanup
Split long lines.
Removed unused imports.
(From OE-Core rev: 49b704864c7db49e41a0b6bbdb8a2840e7fa232b)
Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib')
| -rw-r--r-- | scripts/lib/wic/filemap.py | 8 | ||||
| -rw-r--r-- | scripts/lib/wic/misc.py | 4 | ||||
| -rw-r--r-- | scripts/lib/wic/partition.py | 1 | ||||
| -rw-r--r-- | scripts/lib/wic/pluginbase.py | 1 | ||||
| -rw-r--r-- | scripts/lib/wic/plugins/source/rootfs.py | 2 |
5 files changed, 5 insertions, 11 deletions
diff --git a/scripts/lib/wic/filemap.py b/scripts/lib/wic/filemap.py index 6d11355a18..77e32b9add 100644 --- a/scripts/lib/wic/filemap.py +++ b/scripts/lib/wic/filemap.py | |||
| @@ -34,13 +34,9 @@ def get_block_size(file_obj): | |||
| 34 | Returns block size for file object 'file_obj'. Errors are indicated by the | 34 | Returns block size for file object 'file_obj'. Errors are indicated by the |
| 35 | 'IOError' exception. | 35 | 'IOError' exception. |
| 36 | """ | 36 | """ |
| 37 | |||
| 38 | from fcntl import ioctl | ||
| 39 | import struct | ||
| 40 | |||
| 41 | # Get the block size of the host file-system for the image file by calling | 37 | # Get the block size of the host file-system for the image file by calling |
| 42 | # the FIGETBSZ ioctl (number 2). | 38 | # the FIGETBSZ ioctl (number 2). |
| 43 | binary_data = ioctl(file_obj, 2, struct.pack('I', 0)) | 39 | binary_data = fcntl.ioctl(file_obj, 2, struct.pack('I', 0)) |
| 44 | return struct.unpack('I', binary_data)[0] | 40 | return struct.unpack('I', binary_data)[0] |
| 45 | 41 | ||
| 46 | class ErrorNotSupp(Exception): | 42 | class ErrorNotSupp(Exception): |
| @@ -228,7 +224,7 @@ class FilemapSeek(_FilemapBase): | |||
| 228 | try: | 224 | try: |
| 229 | tmp_obj = tempfile.TemporaryFile("w+", dir=directory) | 225 | tmp_obj = tempfile.TemporaryFile("w+", dir=directory) |
| 230 | except IOError as err: | 226 | except IOError as err: |
| 231 | raise ErrorNotSupp("cannot create a temporary in \"%s\": %s" | 227 | raise ErrorNotSupp("cannot create a temporary in \"%s\": %s" \ |
| 232 | % (directory, err)) | 228 | % (directory, err)) |
| 233 | 229 | ||
| 234 | try: | 230 | try: |
diff --git a/scripts/lib/wic/misc.py b/scripts/lib/wic/misc.py index 46099840ca..8a38f2f479 100644 --- a/scripts/lib/wic/misc.py +++ b/scripts/lib/wic/misc.py | |||
| @@ -131,8 +131,8 @@ def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""): | |||
| 131 | "was not found (see details above).\n\n" % prog | 131 | "was not found (see details above).\n\n" % prog |
| 132 | recipe = NATIVE_RECIPES.get(prog) | 132 | recipe = NATIVE_RECIPES.get(prog) |
| 133 | if recipe: | 133 | if recipe: |
| 134 | msg += "Please make sure wic-tools have %s-native in its DEPENDS, bake it with 'bitbake wic-tools' "\ | 134 | msg += "Please make sure wic-tools have %s-native in its DEPENDS, "\ |
| 135 | "and try again.\n" % recipe | 135 | "build it with 'bitbake wic-tools' and try again.\n" % recipe |
| 136 | else: | 136 | else: |
| 137 | msg += "Wic failed to find a recipe to build native %s. Please "\ | 137 | msg += "Wic failed to find a recipe to build native %s. Please "\ |
| 138 | "file a bug against wic.\n" % prog | 138 | "file a bug against wic.\n" % prog |
diff --git a/scripts/lib/wic/partition.py b/scripts/lib/wic/partition.py index 1851c4a3a5..5aa68c93c1 100644 --- a/scripts/lib/wic/partition.py +++ b/scripts/lib/wic/partition.py | |||
| @@ -26,7 +26,6 @@ | |||
| 26 | 26 | ||
| 27 | import logging | 27 | import logging |
| 28 | import os | 28 | import os |
| 29 | import tempfile | ||
| 30 | 29 | ||
| 31 | from wic import WicError | 30 | from wic import WicError |
| 32 | from wic.misc import exec_cmd, exec_native_cmd, get_bitbake_var | 31 | from wic.misc import exec_cmd, exec_native_cmd, get_bitbake_var |
diff --git a/scripts/lib/wic/pluginbase.py b/scripts/lib/wic/pluginbase.py index 08f9979f3c..c009820adc 100644 --- a/scripts/lib/wic/pluginbase.py +++ b/scripts/lib/wic/pluginbase.py | |||
| @@ -137,4 +137,3 @@ class SourcePlugin(metaclass=PluginMeta): | |||
| 137 | 'prepares' the partition to be incorporated into the image. | 137 | 'prepares' the partition to be incorporated into the image. |
| 138 | """ | 138 | """ |
| 139 | logger.debug("SourcePlugin: do_prepare_partition: part: %s", part) | 139 | logger.debug("SourcePlugin: do_prepare_partition: part: %s", part) |
| 140 | |||
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py index 1b9f68b874..4dc4cb851d 100644 --- a/scripts/lib/wic/plugins/source/rootfs.py +++ b/scripts/lib/wic/plugins/source/rootfs.py | |||
| @@ -34,7 +34,7 @@ from oe.path import copyhardlinktree | |||
| 34 | 34 | ||
| 35 | from wic import WicError | 35 | from wic import WicError |
| 36 | from wic.pluginbase import SourcePlugin | 36 | from wic.pluginbase import SourcePlugin |
| 37 | from wic.misc import get_bitbake_var, exec_cmd | 37 | from wic.misc import get_bitbake_var |
| 38 | 38 | ||
| 39 | logger = logging.getLogger('wic') | 39 | logger = logging.getLogger('wic') |
| 40 | 40 | ||
