mirror of
https://git.yoctoproject.org/poky
synced 2026-09-14 12:49:34 +02:00
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>
This commit is contained in:
committed by
Richard Purdie
parent
dd7e0ae43d
commit
247b7a8c3a
@@ -34,13 +34,9 @@ def get_block_size(file_obj):
|
|||||||
Returns block size for file object 'file_obj'. Errors are indicated by the
|
Returns block size for file object 'file_obj'. Errors are indicated by the
|
||||||
'IOError' exception.
|
'IOError' exception.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from fcntl import ioctl
|
|
||||||
import struct
|
|
||||||
|
|
||||||
# Get the block size of the host file-system for the image file by calling
|
# Get the block size of the host file-system for the image file by calling
|
||||||
# the FIGETBSZ ioctl (number 2).
|
# 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]
|
return struct.unpack('I', binary_data)[0]
|
||||||
|
|
||||||
class ErrorNotSupp(Exception):
|
class ErrorNotSupp(Exception):
|
||||||
@@ -228,7 +224,7 @@ class FilemapSeek(_FilemapBase):
|
|||||||
try:
|
try:
|
||||||
tmp_obj = tempfile.TemporaryFile("w+", dir=directory)
|
tmp_obj = tempfile.TemporaryFile("w+", dir=directory)
|
||||||
except IOError as err:
|
except IOError as err:
|
||||||
raise ErrorNotSupp("cannot create a temporary in \"%s\": %s"
|
raise ErrorNotSupp("cannot create a temporary in \"%s\": %s" \
|
||||||
% (directory, err))
|
% (directory, err))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -131,8 +131,8 @@ def exec_native_cmd(cmd_and_args, native_sysroot, pseudo=""):
|
|||||||
"was not found (see details above).\n\n" % prog
|
"was not found (see details above).\n\n" % prog
|
||||||
recipe = NATIVE_RECIPES.get(prog)
|
recipe = NATIVE_RECIPES.get(prog)
|
||||||
if recipe:
|
if recipe:
|
||||||
msg += "Please make sure wic-tools have %s-native in its DEPENDS, bake it with 'bitbake wic-tools' "\
|
msg += "Please make sure wic-tools have %s-native in its DEPENDS, "\
|
||||||
"and try again.\n" % recipe
|
"build it with 'bitbake wic-tools' and try again.\n" % recipe
|
||||||
else:
|
else:
|
||||||
msg += "Wic failed to find a recipe to build native %s. Please "\
|
msg += "Wic failed to find a recipe to build native %s. Please "\
|
||||||
"file a bug against wic.\n" % prog
|
"file a bug against wic.\n" % prog
|
||||||
|
|||||||
@@ -26,7 +26,6 @@
|
|||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import tempfile
|
|
||||||
|
|
||||||
from wic import WicError
|
from wic import WicError
|
||||||
from wic.misc import exec_cmd, exec_native_cmd, get_bitbake_var
|
from wic.misc import exec_cmd, exec_native_cmd, get_bitbake_var
|
||||||
|
|||||||
@@ -137,4 +137,3 @@ class SourcePlugin(metaclass=PluginMeta):
|
|||||||
'prepares' the partition to be incorporated into the image.
|
'prepares' the partition to be incorporated into the image.
|
||||||
"""
|
"""
|
||||||
logger.debug("SourcePlugin: do_prepare_partition: part: %s", part)
|
logger.debug("SourcePlugin: do_prepare_partition: part: %s", part)
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ from oe.path import copyhardlinktree
|
|||||||
|
|
||||||
from wic import WicError
|
from wic import WicError
|
||||||
from wic.pluginbase import SourcePlugin
|
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')
|
logger = logging.getLogger('wic')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user