summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2015-06-29 18:01:42 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-07-02 23:08:38 +0100
commit34172ef8056244a89cccbbc76de91eca7bc8b0c0 (patch)
tree91e551985b03e728e4bd1df6acee44f7dc8c7d22 /scripts/lib
parent335aa0fee865c23a067562323641bef1dcae687e (diff)
downloadpoky-34172ef8056244a89cccbbc76de91eca7bc8b0c0.tar.gz
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>
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/image/engine.py5
-rw-r--r--scripts/lib/wic/conf.py26
-rw-r--r--scripts/lib/wic/imager/direct.py4
-rw-r--r--scripts/lib/wic/kickstart/custom_commands/micboot.py2
-rw-r--r--scripts/lib/wic/kickstart/custom_commands/partition.py20
-rw-r--r--scripts/lib/wic/msger.py23
-rw-r--r--scripts/lib/wic/plugins/source/bootimg-pcbios.py4
-rw-r--r--scripts/lib/wic/utils/partitionedfs.py5
-rw-r--r--scripts/lib/wic/utils/runner.py2
9 files changed, 51 insertions, 40 deletions
diff --git a/scripts/lib/image/engine.py b/scripts/lib/image/engine.py
index 92dcc5a4f9..0dc7920967 100644
--- a/scripts/lib/image/engine.py
+++ b/scripts/lib/image/engine.py
@@ -236,7 +236,10 @@ def wic_list(args, scripts_path, properties_file):
236 wks_file = args[0] 236 wks_file = args[0]
237 fullpath = find_canned_image(scripts_path, wks_file) 237 fullpath = find_canned_image(scripts_path, wks_file)
238 if not fullpath: 238 if not fullpath:
239 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 239 print "No image named %s found, exiting. "\
240 "(Use 'wic list images' to list available images, or "\
241 "specify a fully-qualified OE kickstart (.wks) "\
242 "filename)\n" % wks_file
240 sys.exit(1) 243 sys.exit(1)
241 list_canned_image_help(scripts_path, fullpath) 244 list_canned_image_help(scripts_path, fullpath)
242 return True 245 return True
diff --git a/scripts/lib/wic/conf.py b/scripts/lib/wic/conf.py
index ff6e2ca0f0..cecf396819 100644
--- a/scripts/lib/wic/conf.py
+++ b/scripts/lib/wic/conf.py
@@ -30,20 +30,18 @@ def get_siteconf():
30 return scripts_path + "/lib/image/config/wic.conf" 30 return scripts_path + "/lib/image/config/wic.conf"
31 31
32class ConfigMgr(object): 32class ConfigMgr(object):
33 DEFAULTS = {'common': { 33 DEFAULTS = {
34 "distro_name": "Default Distribution", 34 'common': {
35 "plugin_dir": "/usr/lib/wic/plugins", # TODO use prefix also? 35 "distro_name": "Default Distribution",
36 }, 36 "plugin_dir": "/usr/lib/wic/plugins"}, # TODO use prefix also?
37 'create': { 37 'create': {
38 "tmpdir": '/var/tmp/wic', 38 "tmpdir": '/var/tmp/wic',
39 "outdir": './wic-output', 39 "outdir": './wic-output',
40 40 "release": None,
41 "release": None, 41 "logfile": None,
42 "logfile": None, 42 "name_prefix": None,
43 "name_prefix": None, 43 "name_suffix": None}
44 "name_suffix": None, 44 }
45 },
46 }
47 45
48 # make the manager class as singleton 46 # make the manager class as singleton
49 _instance = None 47 _instance = None
diff --git a/scripts/lib/wic/imager/direct.py b/scripts/lib/wic/imager/direct.py
index 561c396c28..e2f805832b 100644
--- a/scripts/lib/wic/imager/direct.py
+++ b/scripts/lib/wic/imager/direct.py
@@ -179,8 +179,8 @@ class DirectImageCreator(BaseImageCreator):
179 179
180 if parts[i].mountpoint and not parts[i].fstype: 180 if parts[i].mountpoint and not parts[i].fstype:
181 raise CreatorError("Failed to create disks, no --fstype " 181 raise CreatorError("Failed to create disks, no --fstype "
182 "specified for partition with mountpoint " 182 "specified for partition with mountpoint "
183 "'%s' in the ks file") 183 "'%s' in the ks file")
184 184
185 self._disk_names.append(disk_name) 185 self._disk_names.append(disk_name)
186 186
diff --git a/scripts/lib/wic/kickstart/custom_commands/micboot.py b/scripts/lib/wic/kickstart/custom_commands/micboot.py
index 358b0ea9cd..1fa282b2f6 100644
--- a/scripts/lib/wic/kickstart/custom_commands/micboot.py
+++ b/scripts/lib/wic/kickstart/custom_commands/micboot.py
@@ -27,7 +27,7 @@ class Mic_Bootloader(F8_Bootloader):
27 forceLBA=False, location="", md5pass="", password="", 27 forceLBA=False, location="", md5pass="", password="",
28 upgrade=False, menus=""): 28 upgrade=False, menus=""):
29 F8_Bootloader.__init__(self, writePriority, appendLine, driveorder, 29 F8_Bootloader.__init__(self, writePriority, appendLine, driveorder,
30 forceLBA, location, md5pass, password, upgrade) 30 forceLBA, location, md5pass, password, upgrade)
31 31
32 self.menus = "" 32 self.menus = ""
33 self.ptable = "msdos" 33 self.ptable = "msdos"
diff --git a/scripts/lib/wic/kickstart/custom_commands/partition.py b/scripts/lib/wic/kickstart/custom_commands/partition.py
index fea4d6deb4..045b290ed3 100644
--- a/scripts/lib/wic/kickstart/custom_commands/partition.py
+++ b/scripts/lib/wic/kickstart/custom_commands/partition.py
@@ -157,7 +157,9 @@ class Wic_PartData(Mic_PartData):
157 157
158 if not self.source: 158 if not self.source:
159 if not self.size: 159 if not self.size:
160 msger.error("The %s partition has a size of zero. Please specify a non-zero --size for that partition." % self.mountpoint) 160 msger.error("The %s partition has a size of zero. Please "
161 "specify a non-zero --size for that partition." % \
162 self.mountpoint)
161 if self.fstype and self.fstype == "swap": 163 if self.fstype and self.fstype == "swap":
162 self.prepare_swap_partition(cr_workdir, oe_builddir, 164 self.prepare_swap_partition(cr_workdir, oe_builddir,
163 native_sysroot) 165 native_sysroot)
@@ -178,9 +180,14 @@ class Wic_PartData(Mic_PartData):
178 plugins = pluginmgr.get_source_plugins() 180 plugins = pluginmgr.get_source_plugins()
179 181
180 if self.source not in plugins: 182 if self.source not in plugins:
181 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)) 183 msger.error("The '%s' --source specified for %s doesn't exist.\n\t"
182 184 "See 'wic list source-plugins' for a list of available"
183 self._source_methods = pluginmgr.get_source_plugin_methods(self.source, partition_methods) 185 " --sources.\n\tSee 'wic help source-plugins' for "
186 "details on adding a new source plugin." % \
187 (self.source, self.mountpoint))
188
189 self._source_methods = pluginmgr.get_source_plugin_methods(\
190 self.source, partition_methods)
184 self._source_methods["do_configure_partition"](self, self.sourceparams_dict, 191 self._source_methods["do_configure_partition"](self, self.sourceparams_dict,
185 cr, cr_workdir, 192 cr, cr_workdir,
186 oe_builddir, 193 oe_builddir,
@@ -466,9 +473,10 @@ class Wic_Partition(Mic_Partition):
466 removedAttrs = Mic_Partition.removedAttrs 473 removedAttrs = Mic_Partition.removedAttrs
467 474
468 def _getParser(self): 475 def _getParser(self):
469 def overhead_cb (option, opt_str, value, parser): 476 def overhead_cb(option, opt_str, value, parser):
470 if value < 1: 477 if value < 1:
471 raise OptionValueError("Option %s: invalid value: %r" % (option, value)) 478 raise OptionValueError("Option %s: invalid value: %r" % \
479 (option, value))
472 setattr(parser.values, option.dest, value) 480 setattr(parser.values, option.dest, value)
473 481
474 op = Mic_Partition._getParser(self) 482 op = Mic_Partition._getParser(self)
diff --git a/scripts/lib/wic/msger.py b/scripts/lib/wic/msger.py
index 35b705b867..1b60980296 100644
--- a/scripts/lib/wic/msger.py
+++ b/scripts/lib/wic/msger.py
@@ -16,7 +16,8 @@
16# with this program; if not, write to the Free Software Foundation, Inc., 59 16# with this program; if not, write to the Free Software Foundation, Inc., 59
17# Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19import os,sys 19import os
20import sys
20import re 21import re
21import time 22import time
22 23
@@ -37,8 +38,8 @@ __ALL__ = ['set_mode',
37# COLORs in ANSI 38# COLORs in ANSI
38INFO_COLOR = 32 # green 39INFO_COLOR = 32 # green
39WARN_COLOR = 33 # yellow 40WARN_COLOR = 33 # yellow
40ERR_COLOR = 31 # red 41ERR_COLOR = 31 # red
41ASK_COLOR = 34 # blue 42ASK_COLOR = 34 # blue
42NO_COLOR = 0 43NO_COLOR = 0
43 44
44PREFIX_RE = re.compile('^<(.*?)>\s*(.*)', re.S) 45PREFIX_RE = re.compile('^<(.*?)>\s*(.*)', re.S)
@@ -47,12 +48,12 @@ INTERACTIVE = True
47 48
48LOG_LEVEL = 1 49LOG_LEVEL = 1
49LOG_LEVELS = { 50LOG_LEVELS = {
50 'quiet': 0, 51 'quiet': 0,
51 'normal': 1, 52 'normal': 1,
52 'verbose': 2, 53 'verbose': 2,
53 'debug': 3, 54 'debug': 3,
54 'never': 4, 55 'never': 4,
55 } 56}
56 57
57LOG_FILE_FP = None 58LOG_FILE_FP = None
58LOG_CONTENT = '' 59LOG_CONTENT = ''
@@ -75,7 +76,7 @@ def _general_print(head, color, msg=None, stream=None, level='normal'):
75 76
76 errormsg = '' 77 errormsg = ''
77 if CATCHERR_BUFFILE_FD > 0: 78 if CATCHERR_BUFFILE_FD > 0:
78 size = os.lseek(CATCHERR_BUFFILE_FD , 0, os.SEEK_END) 79 size = os.lseek(CATCHERR_BUFFILE_FD, 0, os.SEEK_END)
79 os.lseek(CATCHERR_BUFFILE_FD, 0, os.SEEK_SET) 80 os.lseek(CATCHERR_BUFFILE_FD, 0, os.SEEK_SET)
80 errormsg = os.read(CATCHERR_BUFFILE_FD, size) 81 errormsg = os.read(CATCHERR_BUFFILE_FD, size)
81 os.ftruncate(CATCHERR_BUFFILE_FD, 0) 82 os.ftruncate(CATCHERR_BUFFILE_FD, 0)
@@ -158,7 +159,7 @@ def _split_msg(head, msg):
158 return head, msg 159 return head, msg
159 160
160def get_loglevel(): 161def get_loglevel():
161 return (k for k,v in LOG_LEVELS.items() if v==LOG_LEVEL).next() 162 return (k for k, v in LOG_LEVELS.items() if v == LOG_LEVEL).next()
162 163
163def set_loglevel(level): 164def set_loglevel(level):
164 global LOG_LEVEL 165 global LOG_LEVEL
diff --git a/scripts/lib/wic/plugins/source/bootimg-pcbios.py b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
index 6ca68f6e7e..721c524970 100644
--- a/scripts/lib/wic/plugins/source/bootimg-pcbios.py
+++ b/scripts/lib/wic/plugins/source/bootimg-pcbios.py
@@ -56,7 +56,9 @@ class BootimgPcbiosPlugin(SourcePlugin):
56 msger.error("Unsupported partition table: %s" % cr.ptable_format) 56 msger.error("Unsupported partition table: %s" % cr.ptable_format)
57 57
58 if not os.path.exists(mbrfile): 58 if not os.path.exists(mbrfile):
59 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) 59 msger.error("Couldn't find %s. If using the -e option, do you "
60 "have the right MACHINE set in local.conf? If not, "
61 "is the bootimg_dir path correct?" % mbrfile)
60 62
61 full_path = cr._full_path(workdir, disk_name, "direct") 63 full_path = cr._full_path(workdir, disk_name, "direct")
62 msger.debug("Installing MBR on disk %s as %s with size %s bytes" \ 64 msger.debug("Installing MBR on disk %s as %s with size %s bytes" \
diff --git a/scripts/lib/wic/utils/partitionedfs.py b/scripts/lib/wic/utils/partitionedfs.py
index ca4b1f06c0..2f884a3cb8 100644
--- a/scripts/lib/wic/utils/partitionedfs.py
+++ b/scripts/lib/wic/utils/partitionedfs.py
@@ -302,9 +302,8 @@ class Image(object):
302 msger.debug("partition %d: set UUID to %s" % \ 302 msger.debug("partition %d: set UUID to %s" % \
303 (p['num'], p['uuid'])) 303 (p['num'], p['uuid']))
304 exec_native_cmd("sgdisk --partition-guid=%d:%s %s" % \ 304 exec_native_cmd("sgdisk --partition-guid=%d:%s %s" % \
305 (p['num'], p['uuid'], 305 (p['num'], p['uuid'], d['disk'].device),
306 d['disk'].device), 306 self.native_sysroot)
307 self.native_sysroot)
308 307
309 if p['boot']: 308 if p['boot']:
310 flag_name = "legacy_boot" if d['ptable_format'] == 'gpt' else "boot" 309 flag_name = "legacy_boot" if d['ptable_format'] == 'gpt' else "boot"
diff --git a/scripts/lib/wic/utils/runner.py b/scripts/lib/wic/utils/runner.py
index 2ae9f417c5..8d48f68034 100644
--- a/scripts/lib/wic/utils/runner.py
+++ b/scripts/lib/wic/utils/runner.py
@@ -89,7 +89,7 @@ def show(cmdln_or_args):
89 else: 89 else:
90 cmd = cmdln_or_args 90 cmd = cmdln_or_args
91 91
92 msg = 'running command: "%s"' % cmd 92 msg = 'running command: "%s"' % cmd
93 if out: out = out.strip() 93 if out: out = out.strip()
94 if out: 94 if out:
95 msg += ', with output::' 95 msg += ', with output::'