summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-01-19 18:51:11 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-01-20 17:07:14 +0000
commit35855a02f81d044c7a3d708719cd05f7dd11a389 (patch)
tree60adade6c63d6c54435bc0731c610af2763293b5 /scripts/lib
parente3b3bcf07ab163eaefbb2537372a4c0fe00bf3ff (diff)
downloadpoky-35855a02f81d044c7a3d708719cd05f7dd11a389.tar.gz
wic: pylinted ksparser module
Added missing docstrings, fixed wrong indentation and long lines. Final pylint score is 9.89/10 (From OE-Core rev: 6e5dd42727b40c6b5ba6235026a6cfc78f482ac9) 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/wic/ksparser.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/scripts/lib/wic/ksparser.py b/scripts/lib/wic/ksparser.py
index 3722799b51..f2a0e04744 100644
--- a/scripts/lib/wic/ksparser.py
+++ b/scripts/lib/wic/ksparser.py
@@ -21,9 +21,9 @@
21# This module provides parser for kickstart format 21# This module provides parser for kickstart format
22# 22#
23# AUTHORS 23# AUTHORS
24# Tom Zanussi <tom.zanussi (at] linux.intel.com>
25# Ed Bartosh <ed.bartosh> (at] linux.intel.com> 24# Ed Bartosh <ed.bartosh> (at] linux.intel.com>
26 25
26"""Kickstart parser module."""
27 27
28import os 28import os
29import shlex 29import shlex
@@ -33,6 +33,7 @@ from wic.partition import Partition
33from wic.utils.misc import find_canned 33from wic.utils.misc import find_canned
34 34
35class KickStartError(Exception): 35class KickStartError(Exception):
36 """Custom exception."""
36 pass 37 pass
37 38
38class KickStartParser(ArgumentParser): 39class KickStartParser(ArgumentParser):
@@ -91,6 +92,8 @@ def cannedpathtype(arg):
91 return result 92 return result
92 93
93class KickStart(object): 94class KickStart(object):
95 """"Kickstart parser implementation."""
96
94 def __init__(self, confpath): 97 def __init__(self, confpath):
95 98
96 self.partitions = [] 99 self.partitions = []
@@ -134,6 +137,9 @@ class KickStart(object):
134 self._parse(parser, confpath) 137 self._parse(parser, confpath)
135 138
136 def _parse(self, parser, confpath): 139 def _parse(self, parser, confpath):
140 """
141 Parse file in .wks format using provided parser.
142 """
137 with open(confpath) as conf: 143 with open(confpath) as conf:
138 lineno = 0 144 lineno = 0
139 for line in conf: 145 for line in conf:
@@ -152,7 +158,8 @@ class KickStart(object):
152 self._parse(parser, parsed.path) 158 self._parse(parser, parsed.path)
153 elif line.startswith('bootloader'): 159 elif line.startswith('bootloader'):
154 if not self.bootloader: 160 if not self.bootloader:
155 self.bootloader = parsed 161 self.bootloader = parsed
156 else: 162 else:
157 raise KickStartError("%s:%d: more than one bootloader "\ 163 err = "%s:%d: more than one bootloader specified" \
158 "specified" % (confpath, lineno)) 164 % (confpath, lineno)
165 raise KickStartError(err)