mirror of
https://git.yoctoproject.org/poky
synced 2026-05-31 00:39:46 +00:00
wic: Code cleanup: long lines, identation and whitespaces
Fixed pylint warnings bad-continuation, bad-continuation and line-too-long. (From OE-Core rev: db43e59f41b6bc19152cd4743585a3217015e272) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
335aa0fee8
commit
34172ef805
@@ -236,7 +236,10 @@ def wic_list(args, scripts_path, properties_file):
|
|||||||
wks_file = args[0]
|
wks_file = args[0]
|
||||||
fullpath = find_canned_image(scripts_path, wks_file)
|
fullpath = find_canned_image(scripts_path, wks_file)
|
||||||
if not fullpath:
|
if not fullpath:
|
||||||
print "No image named %s found, exiting. (Use 'wic list images' to list available images, or specify a fully-qualified OE kickstart (.wks) filename)\n" % wks_file
|
print "No image named %s found, exiting. "\
|
||||||
|
"(Use 'wic list images' to list available images, or "\
|
||||||
|
"specify a fully-qualified OE kickstart (.wks) "\
|
||||||
|
"filename)\n" % wks_file
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
list_canned_image_help(scripts_path, fullpath)
|
list_canned_image_help(scripts_path, fullpath)
|
||||||
return True
|
return True
|
||||||
|
|||||||
+12
-14
@@ -30,20 +30,18 @@ def get_siteconf():
|
|||||||
return scripts_path + "/lib/image/config/wic.conf"
|
return scripts_path + "/lib/image/config/wic.conf"
|
||||||
|
|
||||||
class ConfigMgr(object):
|
class ConfigMgr(object):
|
||||||
DEFAULTS = {'common': {
|
DEFAULTS = {
|
||||||
"distro_name": "Default Distribution",
|
'common': {
|
||||||
"plugin_dir": "/usr/lib/wic/plugins", # TODO use prefix also?
|
"distro_name": "Default Distribution",
|
||||||
},
|
"plugin_dir": "/usr/lib/wic/plugins"}, # TODO use prefix also?
|
||||||
'create': {
|
'create': {
|
||||||
"tmpdir": '/var/tmp/wic',
|
"tmpdir": '/var/tmp/wic',
|
||||||
"outdir": './wic-output',
|
"outdir": './wic-output',
|
||||||
|
"release": None,
|
||||||
"release": None,
|
"logfile": None,
|
||||||
"logfile": None,
|
"name_prefix": None,
|
||||||
"name_prefix": None,
|
"name_suffix": None}
|
||||||
"name_suffix": None,
|
}
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
# make the manager class as singleton
|
# make the manager class as singleton
|
||||||
_instance = None
|
_instance = None
|
||||||
|
|||||||
@@ -179,8 +179,8 @@ class DirectImageCreator(BaseImageCreator):
|
|||||||
|
|
||||||
if parts[i].mountpoint and not parts[i].fstype:
|
if parts[i].mountpoint and not parts[i].fstype:
|
||||||
raise CreatorError("Failed to create disks, no --fstype "
|
raise CreatorError("Failed to create disks, no --fstype "
|
||||||
"specified for partition with mountpoint "
|
"specified for partition with mountpoint "
|
||||||
"'%s' in the ks file")
|
"'%s' in the ks file")
|
||||||
|
|
||||||
self._disk_names.append(disk_name)
|
self._disk_names.append(disk_name)
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class Mic_Bootloader(F8_Bootloader):
|
|||||||
forceLBA=False, location="", md5pass="", password="",
|
forceLBA=False, location="", md5pass="", password="",
|
||||||
upgrade=False, menus=""):
|
upgrade=False, menus=""):
|
||||||
F8_Bootloader.__init__(self, writePriority, appendLine, driveorder,
|
F8_Bootloader.__init__(self, writePriority, appendLine, driveorder,
|
||||||
forceLBA, location, md5pass, password, upgrade)
|
forceLBA, location, md5pass, password, upgrade)
|
||||||
|
|
||||||
self.menus = ""
|
self.menus = ""
|
||||||
self.ptable = "msdos"
|
self.ptable = "msdos"
|
||||||
|
|||||||
@@ -157,7 +157,9 @@ class Wic_PartData(Mic_PartData):
|
|||||||
|
|
||||||
if not self.source:
|
if not self.source:
|
||||||
if not self.size:
|
if not self.size:
|
||||||
msger.error("The %s partition has a size of zero. Please specify a non-zero --size for that partition." % self.mountpoint)
|
msger.error("The %s partition has a size of zero. Please "
|
||||||
|
"specify a non-zero --size for that partition." % \
|
||||||
|
self.mountpoint)
|
||||||
if self.fstype and self.fstype == "swap":
|
if self.fstype and self.fstype == "swap":
|
||||||
self.prepare_swap_partition(cr_workdir, oe_builddir,
|
self.prepare_swap_partition(cr_workdir, oe_builddir,
|
||||||
native_sysroot)
|
native_sysroot)
|
||||||
@@ -178,9 +180,14 @@ class Wic_PartData(Mic_PartData):
|
|||||||
plugins = pluginmgr.get_source_plugins()
|
plugins = pluginmgr.get_source_plugins()
|
||||||
|
|
||||||
if self.source not in plugins:
|
if self.source not in plugins:
|
||||||
msger.error("The '%s' --source specified for %s doesn't exist.\n\tSee 'wic list source-plugins' for a list of available --sources.\n\tSee 'wic help source-plugins' for details on adding a new source plugin." % (self.source, self.mountpoint))
|
msger.error("The '%s' --source specified for %s doesn't exist.\n\t"
|
||||||
|
"See 'wic list source-plugins' for a list of available"
|
||||||
|
" --sources.\n\tSee 'wic help source-plugins' for "
|
||||||
|
"details on adding a new source plugin." % \
|
||||||
|
(self.source, self.mountpoint))
|
||||||
|
|
||||||
self._source_methods = pluginmgr.get_source_plugin_methods(self.source, partition_methods)
|
self._source_methods = pluginmgr.get_source_plugin_methods(\
|
||||||
|
self.source, partition_methods)
|
||||||
self._source_methods["do_configure_partition"](self, self.sourceparams_dict,
|
self._source_methods["do_configure_partition"](self, self.sourceparams_dict,
|
||||||
cr, cr_workdir,
|
cr, cr_workdir,
|
||||||
oe_builddir,
|
oe_builddir,
|
||||||
@@ -466,9 +473,10 @@ class Wic_Partition(Mic_Partition):
|
|||||||
removedAttrs = Mic_Partition.removedAttrs
|
removedAttrs = Mic_Partition.removedAttrs
|
||||||
|
|
||||||
def _getParser(self):
|
def _getParser(self):
|
||||||
def overhead_cb (option, opt_str, value, parser):
|
def overhead_cb(option, opt_str, value, parser):
|
||||||
if value < 1:
|
if value < 1:
|
||||||
raise OptionValueError("Option %s: invalid value: %r" % (option, value))
|
raise OptionValueError("Option %s: invalid value: %r" % \
|
||||||
|
(option, value))
|
||||||
setattr(parser.values, option.dest, value)
|
setattr(parser.values, option.dest, value)
|
||||||
|
|
||||||
op = Mic_Partition._getParser(self)
|
op = Mic_Partition._getParser(self)
|
||||||
|
|||||||
+12
-11
@@ -16,7 +16,8 @@
|
|||||||
# with this program; if not, write to the Free Software Foundation, Inc., 59
|
# with this program; if not, write to the Free Software Foundation, Inc., 59
|
||||||
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
import os,sys
|
import os
|
||||||
|
import sys
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
|
||||||
@@ -37,8 +38,8 @@ __ALL__ = ['set_mode',
|
|||||||
# COLORs in ANSI
|
# COLORs in ANSI
|
||||||
INFO_COLOR = 32 # green
|
INFO_COLOR = 32 # green
|
||||||
WARN_COLOR = 33 # yellow
|
WARN_COLOR = 33 # yellow
|
||||||
ERR_COLOR = 31 # red
|
ERR_COLOR = 31 # red
|
||||||
ASK_COLOR = 34 # blue
|
ASK_COLOR = 34 # blue
|
||||||
NO_COLOR = 0
|
NO_COLOR = 0
|
||||||
|
|
||||||
PREFIX_RE = re.compile('^<(.*?)>\s*(.*)', re.S)
|
PREFIX_RE = re.compile('^<(.*?)>\s*(.*)', re.S)
|
||||||
@@ -47,12 +48,12 @@ INTERACTIVE = True
|
|||||||
|
|
||||||
LOG_LEVEL = 1
|
LOG_LEVEL = 1
|
||||||
LOG_LEVELS = {
|
LOG_LEVELS = {
|
||||||
'quiet': 0,
|
'quiet': 0,
|
||||||
'normal': 1,
|
'normal': 1,
|
||||||
'verbose': 2,
|
'verbose': 2,
|
||||||
'debug': 3,
|
'debug': 3,
|
||||||
'never': 4,
|
'never': 4,
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG_FILE_FP = None
|
LOG_FILE_FP = None
|
||||||
LOG_CONTENT = ''
|
LOG_CONTENT = ''
|
||||||
@@ -75,7 +76,7 @@ def _general_print(head, color, msg=None, stream=None, level='normal'):
|
|||||||
|
|
||||||
errormsg = ''
|
errormsg = ''
|
||||||
if CATCHERR_BUFFILE_FD > 0:
|
if CATCHERR_BUFFILE_FD > 0:
|
||||||
size = os.lseek(CATCHERR_BUFFILE_FD , 0, os.SEEK_END)
|
size = os.lseek(CATCHERR_BUFFILE_FD, 0, os.SEEK_END)
|
||||||
os.lseek(CATCHERR_BUFFILE_FD, 0, os.SEEK_SET)
|
os.lseek(CATCHERR_BUFFILE_FD, 0, os.SEEK_SET)
|
||||||
errormsg = os.read(CATCHERR_BUFFILE_FD, size)
|
errormsg = os.read(CATCHERR_BUFFILE_FD, size)
|
||||||
os.ftruncate(CATCHERR_BUFFILE_FD, 0)
|
os.ftruncate(CATCHERR_BUFFILE_FD, 0)
|
||||||
@@ -158,7 +159,7 @@ def _split_msg(head, msg):
|
|||||||
return head, msg
|
return head, msg
|
||||||
|
|
||||||
def get_loglevel():
|
def get_loglevel():
|
||||||
return (k for k,v in LOG_LEVELS.items() if v==LOG_LEVEL).next()
|
return (k for k, v in LOG_LEVELS.items() if v == LOG_LEVEL).next()
|
||||||
|
|
||||||
def set_loglevel(level):
|
def set_loglevel(level):
|
||||||
global LOG_LEVEL
|
global LOG_LEVEL
|
||||||
|
|||||||
@@ -56,7 +56,9 @@ class BootimgPcbiosPlugin(SourcePlugin):
|
|||||||
msger.error("Unsupported partition table: %s" % cr.ptable_format)
|
msger.error("Unsupported partition table: %s" % cr.ptable_format)
|
||||||
|
|
||||||
if not os.path.exists(mbrfile):
|
if not os.path.exists(mbrfile):
|
||||||
msger.error("Couldn't find %s. If using the -e option, do you have the right MACHINE set in local.conf? If not, is the bootimg_dir path correct?" % mbrfile)
|
msger.error("Couldn't find %s. If using the -e option, do you "
|
||||||
|
"have the right MACHINE set in local.conf? If not, "
|
||||||
|
"is the bootimg_dir path correct?" % mbrfile)
|
||||||
|
|
||||||
full_path = cr._full_path(workdir, disk_name, "direct")
|
full_path = cr._full_path(workdir, disk_name, "direct")
|
||||||
msger.debug("Installing MBR on disk %s as %s with size %s bytes" \
|
msger.debug("Installing MBR on disk %s as %s with size %s bytes" \
|
||||||
|
|||||||
@@ -302,9 +302,8 @@ class Image(object):
|
|||||||
msger.debug("partition %d: set UUID to %s" % \
|
msger.debug("partition %d: set UUID to %s" % \
|
||||||
(p['num'], p['uuid']))
|
(p['num'], p['uuid']))
|
||||||
exec_native_cmd("sgdisk --partition-guid=%d:%s %s" % \
|
exec_native_cmd("sgdisk --partition-guid=%d:%s %s" % \
|
||||||
(p['num'], p['uuid'],
|
(p['num'], p['uuid'], d['disk'].device),
|
||||||
d['disk'].device),
|
self.native_sysroot)
|
||||||
self.native_sysroot)
|
|
||||||
|
|
||||||
if p['boot']:
|
if p['boot']:
|
||||||
flag_name = "legacy_boot" if d['ptable_format'] == 'gpt' else "boot"
|
flag_name = "legacy_boot" if d['ptable_format'] == 'gpt' else "boot"
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ def show(cmdln_or_args):
|
|||||||
else:
|
else:
|
||||||
cmd = cmdln_or_args
|
cmd = cmdln_or_args
|
||||||
|
|
||||||
msg = 'running command: "%s"' % cmd
|
msg = 'running command: "%s"' % cmd
|
||||||
if out: out = out.strip()
|
if out: out = out.strip()
|
||||||
if out:
|
if out:
|
||||||
msg += ', with output::'
|
msg += ', with output::'
|
||||||
|
|||||||
+17
-9
@@ -90,18 +90,24 @@ def wic_create_subcommand(args, usage_str):
|
|||||||
parser = optparse.OptionParser(usage=usage_str)
|
parser = optparse.OptionParser(usage=usage_str)
|
||||||
|
|
||||||
parser.add_option("-o", "--outdir", dest="outdir",
|
parser.add_option("-o", "--outdir", dest="outdir",
|
||||||
action="store", help="name of directory to create image in")
|
help="name of directory to create image in")
|
||||||
parser.add_option("-e", "--image-name", dest="image_name",
|
parser.add_option("-e", "--image-name", dest="image_name",
|
||||||
action="store", help="name of the image to use the artifacts from e.g. core-image-sato")
|
help="name of the image to use the artifacts from "
|
||||||
parser.add_option("-r", "--rootfs-dir", dest="rootfs_dir",
|
"e.g. core-image-sato")
|
||||||
action="callback", callback=callback_rootfs_dir, type="string",
|
parser.add_option("-r", "--rootfs-dir", dest="rootfs_dir", type="string",
|
||||||
help="path to the /rootfs dir to use as the .wks rootfs source")
|
action="callback", callback=callback_rootfs_dir,
|
||||||
|
help="path to the /rootfs dir to use as the "
|
||||||
|
".wks rootfs source")
|
||||||
parser.add_option("-b", "--bootimg-dir", dest="bootimg_dir",
|
parser.add_option("-b", "--bootimg-dir", dest="bootimg_dir",
|
||||||
action="store", help="path to the dir containing the boot artifacts (e.g. /EFI or /syslinux dirs) to use as the .wks bootimg source")
|
help="path to the dir containing the boot artifacts "
|
||||||
|
"(e.g. /EFI or /syslinux dirs) to use as the "
|
||||||
|
".wks bootimg source")
|
||||||
parser.add_option("-k", "--kernel-dir", dest="kernel_dir",
|
parser.add_option("-k", "--kernel-dir", dest="kernel_dir",
|
||||||
action="store", help="path to the dir containing the kernel to use in the .wks bootimg")
|
help="path to the dir containing the kernel to use "
|
||||||
|
"in the .wks bootimg")
|
||||||
parser.add_option("-n", "--native-sysroot", dest="native_sysroot",
|
parser.add_option("-n", "--native-sysroot", dest="native_sysroot",
|
||||||
action="store", help="path to the native sysroot containing the tools to use to build the image")
|
help="path to the native sysroot containing the tools "
|
||||||
|
"to use to build the image")
|
||||||
parser.add_option("-p", "--skip-build-check", dest="build_check",
|
parser.add_option("-p", "--skip-build-check", dest="build_check",
|
||||||
action="store_false", default=True, help="skip the build check")
|
action="store_false", default=True, help="skip the build check")
|
||||||
parser.add_option("-f", "--build-rootfs", action="store_true", help="build rootfs")
|
parser.add_option("-f", "--build-rootfs", action="store_true", help="build rootfs")
|
||||||
@@ -173,7 +179,9 @@ def wic_create_subcommand(args, usage_str):
|
|||||||
if not wks_file.endswith(".wks"):
|
if not wks_file.endswith(".wks"):
|
||||||
wks_file = engine.find_canned_image(scripts_path, wks_file)
|
wks_file = engine.find_canned_image(scripts_path, wks_file)
|
||||||
if not wks_file:
|
if not wks_file:
|
||||||
print "No image named %s found, exiting. (Use 'wic list images' to list available images, or specify a fully-qualified OE kickstart (.wks) filename)\n" % args[0]
|
print "No image named %s found, exiting. (Use 'wic list images' "\
|
||||||
|
"to list available images, or specify a fully-qualified OE "\
|
||||||
|
"kickstart (.wks) filename)\n" % args[0]
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
image_output_dir = ""
|
image_output_dir = ""
|
||||||
|
|||||||
Reference in New Issue
Block a user