1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-31 12:49:46 +00:00

wic:code cleanup: No space allowed

Fixed pylint warning
  'No space allowed around keyword argument assignment'

(From OE-Core rev: e07dd9b9c71960fbeded162ed52fbce06de620e9)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ed Bartosh
2015-04-09 14:36:49 +03:00
committed by Richard Purdie
parent 1521a3dda0
commit d0d0ab85c4
9 changed files with 59 additions and 59 deletions
+4 -4
View File
@@ -42,7 +42,7 @@ class BaseImageCreator(object):
def __del__(self): def __del__(self):
self.cleanup() self.cleanup()
def __init__(self, createopts = None): def __init__(self, createopts=None):
"""Initialize an ImageCreator instance. """Initialize an ImageCreator instance.
ks -- a pykickstart.KickstartParser instance; this instance will be ks -- a pykickstart.KickstartParser instance; this instance will be
@@ -131,8 +131,8 @@ class BaseImageCreator(object):
self.workdir = os.path.join(self.tmpdir, "build") self.workdir = os.path.join(self.tmpdir, "build")
if not os.path.exists(self.workdir): if not os.path.exists(self.workdir):
os.makedirs(self.workdir) os.makedirs(self.workdir)
self.__builddir = tempfile.mkdtemp(dir = self.workdir, self.__builddir = tempfile.mkdtemp(dir=self.workdir,
prefix = "imgcreate-") prefix="imgcreate-")
except OSError, (err, msg): except OSError, (err, msg):
raise CreatorError("Failed create build directory in %s: %s" % raise CreatorError("Failed create build directory in %s: %s" %
(self.tmpdir, msg)) (self.tmpdir, msg))
@@ -178,7 +178,7 @@ class BaseImageCreator(object):
self._cleanup() self._cleanup()
shutil.rmtree(self.__builddir, ignore_errors = True) shutil.rmtree(self.__builddir, ignore_errors=True)
self.__builddir = None self.__builddir = None
self.__clean_tmpdir() self.__clean_tmpdir()
+5 -5
View File
@@ -269,11 +269,11 @@ class DirectImageCreator(BaseImageCreator):
p.source_file, p.source_file,
p.fstype, p.fstype,
p.label, p.label,
fsopts = p.fsopts, fsopts=p.fsopts,
boot = p.active, boot=p.active,
align = p.align, align=p.align,
no_table = p.no_table, no_table=p.no_table,
part_type = p.part_type) part_type=p.part_type)
self._restore_fstab(fstab) self._restore_fstab(fstab)
+7 -7
View File
@@ -68,7 +68,7 @@ def read_kickstart(path):
return ks return ks
def get_image_size(ks, default = None): def get_image_size(ks, default=None):
__size = 0 __size = 0
for p in ks.handler.partition.partitions: for p in ks.handler.partition.partitions:
if p.mountpoint == "/" and p.size: if p.mountpoint == "/" and p.size:
@@ -78,40 +78,40 @@ def get_image_size(ks, default = None):
else: else:
return default return default
def get_image_fstype(ks, default = None): def get_image_fstype(ks, default=None):
for p in ks.handler.partition.partitions: for p in ks.handler.partition.partitions:
if p.mountpoint == "/" and p.fstype: if p.mountpoint == "/" and p.fstype:
return p.fstype return p.fstype
return default return default
def get_image_fsopts(ks, default = None): def get_image_fsopts(ks, default=None):
for p in ks.handler.partition.partitions: for p in ks.handler.partition.partitions:
if p.mountpoint == "/" and p.fsopts: if p.mountpoint == "/" and p.fsopts:
return p.fsopts return p.fsopts
return default return default
def get_timeout(ks, default = None): def get_timeout(ks, default=None):
if not hasattr(ks.handler.bootloader, "timeout"): if not hasattr(ks.handler.bootloader, "timeout"):
return default return default
if ks.handler.bootloader.timeout is None: if ks.handler.bootloader.timeout is None:
return default return default
return int(ks.handler.bootloader.timeout) return int(ks.handler.bootloader.timeout)
def get_kernel_args(ks, default = "ro rd.live.image"): def get_kernel_args(ks, default="ro rd.live.image"):
if not hasattr(ks.handler.bootloader, "appendLine"): if not hasattr(ks.handler.bootloader, "appendLine"):
return default return default
if ks.handler.bootloader.appendLine is None: if ks.handler.bootloader.appendLine is None:
return default return default
return "%s %s" %(default, ks.handler.bootloader.appendLine) return "%s %s" %(default, ks.handler.bootloader.appendLine)
def get_menu_args(ks, default = ""): def get_menu_args(ks, default=""):
if not hasattr(ks.handler.bootloader, "menus"): if not hasattr(ks.handler.bootloader, "menus"):
return default return default
if ks.handler.bootloader.menus in (None, ""): if ks.handler.bootloader.menus in (None, ""):
return default return default
return "%s" % ks.handler.bootloader.menus return "%s" % ks.handler.bootloader.menus
def get_default_kernel(ks, default = None): def get_default_kernel(ks, default=None):
if not hasattr(ks.handler.bootloader, "default"): if not hasattr(ks.handler.bootloader, "default"):
return default return default
if not ks.handler.bootloader.default: if not ks.handler.bootloader.default:
+5 -5
View File
@@ -60,7 +60,7 @@ CATCHERR_BUFFILE_FD = -1
CATCHERR_BUFFILE_PATH = None CATCHERR_BUFFILE_PATH = None
CATCHERR_SAVED_2 = -1 CATCHERR_SAVED_2 = -1
def _general_print(head, color, msg = None, stream = None, level = 'normal'): def _general_print(head, color, msg=None, stream=None, level='normal'):
global LOG_CONTENT global LOG_CONTENT
if not stream: if not stream:
stream = sys.stdout stream = sys.stdout
@@ -130,7 +130,7 @@ def _color_print(head, color, msg, stream, level):
stream.flush() stream.flush()
def _color_perror(head, color, msg, level = 'normal'): def _color_perror(head, color, msg, level='normal'):
if CATCHERR_BUFFILE_FD > 0: if CATCHERR_BUFFILE_FD > 0:
_general_print(head, color, msg, sys.stdout, level) _general_print(head, color, msg, sys.stdout, level)
else: else:
@@ -190,7 +190,7 @@ def info(msg):
def verbose(msg): def verbose(msg):
head, msg = _split_msg('Verbose', msg) head, msg = _split_msg('Verbose', msg)
_general_print(head, INFO_COLOR, msg, level = 'verbose') _general_print(head, INFO_COLOR, msg, level='verbose')
def warning(msg): def warning(msg):
head, msg = _split_msg('Warning', msg) head, msg = _split_msg('Warning', msg)
@@ -198,7 +198,7 @@ def warning(msg):
def debug(msg): def debug(msg):
head, msg = _split_msg('Debug', msg) head, msg = _split_msg('Debug', msg)
_color_perror(head, ERR_COLOR, msg, level = 'debug') _color_perror(head, ERR_COLOR, msg, level='debug')
def error(msg): def error(msg):
head, msg = _split_msg('Error', msg) head, msg = _split_msg('Error', msg)
@@ -299,7 +299,7 @@ def disable_logstderr():
global CATCHERR_BUFFILE_PATH global CATCHERR_BUFFILE_PATH
global CATCHERR_SAVED_2 global CATCHERR_SAVED_2
raw(msg = None) # flush message buffer and print it. raw(msg=None) # flush message buffer and print it.
os.dup2(CATCHERR_SAVED_2, 2) os.dup2(CATCHERR_SAVED_2, 2)
os.close(CATCHERR_SAVED_2) os.close(CATCHERR_SAVED_2)
os.close(CATCHERR_BUFFILE_FD) os.close(CATCHERR_BUFFILE_FD)
+1 -1
View File
@@ -57,7 +57,7 @@ class Disk:
""" """
Generic base object for a disk. Generic base object for a disk.
""" """
def __init__(self, size, device = None): def __init__(self, size, device=None):
self._device = device self._device = device
self._size = size self._size = size
+1 -1
View File
@@ -18,7 +18,7 @@
import os import os
import time import time
def build_name(kscfg, release=None, prefix = None, suffix = None): def build_name(kscfg, release=None, prefix=None, suffix=None):
"""Construct and return an image name string. """Construct and return an image name string.
This is a utility function to help create sensible name and fslabel This is a utility function to help create sensible name and fslabel
+4 -4
View File
@@ -28,7 +28,7 @@
from wic import msger from wic import msger
from wic.utils import runner from wic.utils import runner
def __exec_cmd(cmd_and_args, as_shell = False, catch = 3): def __exec_cmd(cmd_and_args, as_shell=False, catch=3):
""" """
Execute command, catching stderr, stdout Execute command, catching stderr, stdout
@@ -49,7 +49,7 @@ def __exec_cmd(cmd_and_args, as_shell = False, catch = 3):
return (rc, out) return (rc, out)
def exec_cmd(cmd_and_args, as_shell = False, catch = 3): def exec_cmd(cmd_and_args, as_shell=False, catch=3):
""" """
Execute command, catching stderr, stdout Execute command, catching stderr, stdout
@@ -63,7 +63,7 @@ def exec_cmd(cmd_and_args, as_shell = False, catch = 3):
return out return out
def exec_cmd_quiet(cmd_and_args, as_shell = False): def exec_cmd_quiet(cmd_and_args, as_shell=False):
""" """
Execute command, catching nothing in the output Execute command, catching nothing in the output
@@ -72,7 +72,7 @@ def exec_cmd_quiet(cmd_and_args, as_shell = False):
return exec_cmd(cmd_and_args, as_shell, 0) return exec_cmd(cmd_and_args, as_shell, 0)
def exec_native_cmd(cmd_and_args, native_sysroot, catch = 3): def exec_native_cmd(cmd_and_args, native_sysroot, catch=3):
""" """
Execute native command, catching stderr, stdout Execute native command, catching stderr, stdout
+4 -4
View File
@@ -86,9 +86,9 @@ class Image:
self.partitions.append(part) self.partitions.append(part)
self.__add_disk(part['disk_name']) self.__add_disk(part['disk_name'])
def add_partition(self, size, disk_name, mountpoint, source_file = None, fstype = None, def add_partition(self, size, disk_name, mountpoint, source_file=None, fstype=None,
label=None, fsopts = None, boot = False, align = None, no_table=False, label=None, fsopts=None, boot=False, align=None, no_table=False,
part_type = None): part_type=None):
""" Add the next partition. Prtitions have to be added in the """ Add the next partition. Prtitions have to be added in the
first-to-last order. """ first-to-last order. """
@@ -116,7 +116,7 @@ class Image:
self.__add_partition(part) self.__add_partition(part)
def layout_partitions(self, ptable_format = "msdos"): def layout_partitions(self, ptable_format="msdos"):
""" Layout the partitions, meaning calculate the position of every """ Layout the partitions, meaning calculate the position of every
partition on the disk. The 'ptable_format' parameter defines the partition on the disk. The 'ptable_format' parameter defines the
partition table format and may be "msdos". """ partition table format and may be "msdos". """
+28 -28
View File
@@ -79,28 +79,28 @@ def wic_create_subcommand(args, usage_str):
Command-line handling for image creation. The real work is done Command-line handling for image creation. The real work is done
by image.engine.wic_create() by image.engine.wic_create()
""" """
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") action="store", help="name of directory to create image in")
parser.add_option("-i", "--infile", dest = "properties_file", parser.add_option("-i", "--infile", dest="properties_file",
action = "store", help = "name of file containing the values for image properties as a JSON file") action="store", help="name of file containing the values for image properties as a JSON file")
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") action="store", help="name of the image to use the artifacts from e.g. core-image-sato")
parser.add_option("-r", "--rootfs-dir", dest = "rootfs_dir", parser.add_option("-r", "--rootfs-dir", dest="rootfs_dir",
action = "callback", callback = callback_rootfs_dir, type = "string", action="callback", callback=callback_rootfs_dir, type="string",
help = "path to the /rootfs dir to use as the .wks rootfs source") 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") action="store", 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") action="store", 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") action="store", 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")
parser.add_option("-D", "--debug", dest = "debug", action = "store_true", parser.add_option("-D", "--debug", dest="debug", action="store_true",
default = False, help = "output debug information") default=False, help="output debug information")
(options, args) = parser.parse_args(args) (options, args) = parser.parse_args(args)
@@ -223,11 +223,11 @@ def wic_list_subcommand(args, usage_str):
Command-line handling for listing available image properties and Command-line handling for listing available image properties and
values. The real work is done by image.engine.wic_list() values. The real work is done by image.engine.wic_list()
""" """
parser = optparse.OptionParser(usage = usage_str) parser = optparse.OptionParser(usage=usage_str)
parser.add_option("-o", "--outfile", action = "store", parser.add_option("-o", "--outfile", action="store",
dest = "properties_file", dest="properties_file",
help = "dump the possible values for image properties to a JSON file") help="dump the possible values for image properties to a JSON file")
(options, args) = parser.parse_args(args) (options, args) = parser.parse_args(args)
@@ -276,12 +276,12 @@ subcommands = {
def start_logging(loglevel): def start_logging(loglevel):
logging.basicConfig(filname = 'wic.log', filemode = 'w', level=loglevel) logging.basicConfig(filname='wic.log', filemode='w', level=loglevel)
def main(): def main():
parser = optparse.OptionParser(version = "wic version %s" % __version__, parser = optparse.OptionParser(version="wic version %s" % __version__,
usage = wic_usage) usage=wic_usage)
parser.disable_interspersed_args() parser.disable_interspersed_args()