wic: code cleanup: superfluous-parens

Removed unncecessary parents after 'if' 'del' and 'print' keywords.
Fixed pyling warning: Unnecessary parens after 'xxx' keyword

(From OE-Core rev: a64604d11f75973b4c2347fa2669da9889e44013)

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-06-17 14:47:47 +03:00 committed by Richard Purdie
parent 4862a4c33a
commit a4da21d92f
8 changed files with 23 additions and 23 deletions

View File

@ -70,13 +70,13 @@ def find_artifacts(image_name):
rootfs_dir = kernel_dir = bootimg_dir = native_sysroot = "" rootfs_dir = kernel_dir = bootimg_dir = native_sysroot = ""
for line in bitbake_env_lines.split('\n'): for line in bitbake_env_lines.split('\n'):
if (misc.get_line_val(line, "IMAGE_ROOTFS")): if misc.get_line_val(line, "IMAGE_ROOTFS"):
rootfs_dir = misc.get_line_val(line, "IMAGE_ROOTFS") rootfs_dir = misc.get_line_val(line, "IMAGE_ROOTFS")
continue continue
if (misc.get_line_val(line, "DEPLOY_DIR_IMAGE")): if misc.get_line_val(line, "DEPLOY_DIR_IMAGE"):
kernel_dir = misc.get_line_val(line, "DEPLOY_DIR_IMAGE") kernel_dir = misc.get_line_val(line, "DEPLOY_DIR_IMAGE")
continue continue
if (misc.get_line_val(line, "STAGING_DIR_NATIVE")): if misc.get_line_val(line, "STAGING_DIR_NATIVE"):
native_sysroot = misc.get_line_val(line, "STAGING_DIR_NATIVE") native_sysroot = misc.get_line_val(line, "STAGING_DIR_NATIVE")
continue continue

View File

@ -53,7 +53,7 @@ def wic_help(args, usage_str, subcommands):
Subcommand help dispatcher. Subcommand help dispatcher.
""" """
if len(args) == 1 or not display_help(args[1], subcommands): if len(args) == 1 or not display_help(args[1], subcommands):
print(usage_str) print usage_str
def get_wic_plugins_help(): def get_wic_plugins_help():

View File

@ -145,19 +145,19 @@ def _check_string(option, opt, value):
def _check_size(option, opt, value): def _check_size(option, opt, value):
# Former default was MB # Former default was MB
if (value.isdigit()): if value.isdigit():
return int(value) * 1024L return int(value) * 1024L
mapping = {"opt": opt, "value": value} mapping = {"opt": opt, "value": value}
if (not value[:-1].isdigit()): if not value[:-1].isdigit():
raise OptionValueError(_("Option %(opt)s: invalid size value: %(value)r") % mapping) raise OptionValueError(_("Option %(opt)s: invalid size value: %(value)r") % mapping)
size = int(value[:-1]) size = int(value[:-1])
if (value.endswith("k") or value.endswith("K")): if value.endswith("k") or value.endswith("K"):
return size return size
if (value.endswith("M")): if value.endswith("M"):
return size * 1024L return size * 1024L
if (value.endswith("G")): if value.endswith("G"):
return size * 1024L * 1024L return size * 1024L * 1024L
raise OptionValueError(_("Option %(opt)s: invalid size value: %(value)r") % mapping) raise OptionValueError(_("Option %(opt)s: invalid size value: %(value)r") % mapping)

View File

@ -268,7 +268,7 @@ class Wic_PartData(Mic_PartData):
extra_imagecmd = "-i 8192" extra_imagecmd = "-i 8192"
label_str = "" label_str = ""
if (self.label): if self.label:
label_str = "-L %s" % self.label label_str = "-L %s" % self.label
mkfs_cmd = "mkfs.%s -F %s %s %s -d %s" % \ mkfs_cmd = "mkfs.%s -F %s %s %s -d %s" % \
@ -315,7 +315,7 @@ class Wic_PartData(Mic_PartData):
exec_cmd(dd_cmd) exec_cmd(dd_cmd)
label_str = "" label_str = ""
if (self.label): if self.label:
label_str = "-L %s" % self.label label_str = "-L %s" % self.label
mkfs_cmd = "mkfs.%s -b %d -r %s %s %s" % \ mkfs_cmd = "mkfs.%s -b %d -r %s %s %s" % \
@ -361,7 +361,7 @@ class Wic_PartData(Mic_PartData):
blocks += (16 - (blocks % 16)) blocks += (16 - (blocks % 16))
label_str = "-n boot" label_str = "-n boot"
if (self.label): if self.label:
label_str = "-n %s" % self.label label_str = "-n %s" % self.label
dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, rootfs, blocks) dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, rootfs, blocks)
@ -436,7 +436,7 @@ class Wic_PartData(Mic_PartData):
extra_imagecmd = "-i 8192" extra_imagecmd = "-i 8192"
label_str = "" label_str = ""
if (self.label): if self.label:
label_str = "-L %s" % self.label label_str = "-L %s" % self.label
mkfs_cmd = "mkfs.%s -F %s %s %s" % \ mkfs_cmd = "mkfs.%s -F %s %s %s" % \
@ -460,7 +460,7 @@ class Wic_PartData(Mic_PartData):
exec_cmd(dd_cmd) exec_cmd(dd_cmd)
label_str = "" label_str = ""
if (self.label): if self.label:
label_str = "-L %s" % self.label label_str = "-L %s" % self.label
mkfs_cmd = "mkfs.%s -b %d %s %s" % \ mkfs_cmd = "mkfs.%s -b %d %s %s" % \
@ -482,7 +482,7 @@ class Wic_PartData(Mic_PartData):
blocks = self.size blocks = self.size
label_str = "-n boot" label_str = "-n boot"
if (self.label): if self.label:
label_str = "-n %s" % self.label label_str = "-n %s" % self.label
dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, fs, blocks) dosfs_cmd = "mkdosfs %s -S 512 -C %s %d" % (label_str, fs, blocks)
@ -553,7 +553,7 @@ class Wic_Partition(Mic_Partition):
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)

View File

@ -103,7 +103,7 @@ class PluginMgr(object):
% (os.path.basename(pdir), mod, err) % (os.path.basename(pdir), mod, err)
msger.warning(msg) msger.warning(msg)
del(sys.path[0]) del sys.path[0]
def get_plugins(self, ptype): def get_plugins(self, ptype):
""" the return value is dict of name:class pairs """ """ the return value is dict of name:class pairs """

View File

@ -62,7 +62,7 @@ class FSImagePlugin(SourcePlugin):
msger.debug('Bootimg dir: %s' % bootimg_dir) msger.debug('Bootimg dir: %s' % bootimg_dir)
if ('file' not in source_params): if 'file' not in source_params:
msger.error("No file specified\n") msger.error("No file specified\n")
return return

View File

@ -62,14 +62,14 @@ class RawCopyPlugin(SourcePlugin):
msger.debug('Bootimg dir: %s' % bootimg_dir) msger.debug('Bootimg dir: %s' % bootimg_dir)
if ('file' not in source_params): if 'file' not in source_params:
msger.error("No file specified\n") msger.error("No file specified\n")
return return
src = os.path.join(bootimg_dir, source_params['file']) src = os.path.join(bootimg_dir, source_params['file'])
dst = src dst = src
if ('skip' in source_params): if 'skip' in source_params:
dst = os.path.join(cr_workdir, source_params['file']) dst = os.path.join(cr_workdir, source_params['file'])
dd_cmd = "dd if=%s of=%s ibs=%s skip=1 conv=notrunc" % \ dd_cmd = "dd if=%s of=%s ibs=%s skip=1 conv=notrunc" % \
(src, dst, source_params['skip']) (src, dst, source_params['skip'])

View File

@ -38,7 +38,7 @@ def __exec_cmd(cmd_and_args, as_shell=False, catch=3):
args = cmd_and_args.split() args = cmd_and_args.split()
msger.debug(args) msger.debug(args)
if (as_shell): if as_shell:
rc, out = runner.runtool(cmd_and_args, catch) rc, out = runner.runtool(cmd_and_args, catch)
else: else:
rc, out = runner.runtool(args, catch) rc, out = runner.runtool(args, catch)
@ -142,7 +142,7 @@ def find_artifact(bitbake_env_lines, variable):
retval = "" retval = ""
for line in bitbake_env_lines.split('\n'): for line in bitbake_env_lines.split('\n'):
if (get_line_val(line, variable)): if get_line_val(line, variable):
retval = get_line_val(line, variable) retval = get_line_val(line, variable)
break break
@ -160,7 +160,7 @@ def get_line_val(line, key):
def get_bitbake_var(key): def get_bitbake_var(key):
for line in __bitbake_env_lines.split('\n'): for line in __bitbake_env_lines.split('\n'):
if (get_line_val(line, key)): if get_line_val(line, key):
val = get_line_val(line, key) val = get_line_val(line, key)
return val return val
return None return None