summaryrefslogtreecommitdiffstats
path: root/scripts/lib/wic
diff options
context:
space:
mode:
authorEd Bartosh <ed.bartosh@linux.intel.com>2016-05-04 16:06:20 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-14 23:05:13 +0100
commitd4ded7fcb159e55134b7612dbdc928613c7321c6 (patch)
tree59eefc5e1b1ed5c108cc2c92451f84539af62159 /scripts/lib/wic
parente301be3cd09499e605fb204fc4f197eca11f9305 (diff)
downloadpoky-d4ded7fcb159e55134b7612dbdc928613c7321c6.tar.gz
wic: remove unused functions
Removed 'raw', 'ask', 'choice' and 'pause' functions from msger.py as they're not used in wic code and some of them use raw_input, which is not present in Python 3. [YOCTO #9412] (From OE-Core rev: eb87d591ef67f1953b2689430ef6c5a6a27a5b6e) Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/wic')
-rw-r--r--scripts/lib/wic/msger.py69
1 files changed, 1 insertions, 68 deletions
diff --git a/scripts/lib/wic/msger.py b/scripts/lib/wic/msger.py
index b737554228..2340ac2f10 100644
--- a/scripts/lib/wic/msger.py
+++ b/scripts/lib/wic/msger.py
@@ -21,18 +21,14 @@ import sys
21import re 21import re
22import time 22import time
23 23
24__ALL__ = ['set_mode', 24__ALL__ = ['get_loglevel',
25 'get_loglevel',
26 'set_loglevel', 25 'set_loglevel',
27 'set_logfile', 26 'set_logfile',
28 'raw',
29 'debug', 27 'debug',
30 'verbose', 28 'verbose',
31 'info', 29 'info',
32 'warning', 30 'warning',
33 'error', 31 'error',
34 'ask',
35 'pause',
36 ] 32 ]
37 33
38# COLORs in ANSI 34# COLORs in ANSI
@@ -182,9 +178,6 @@ def log(msg=''):
182 if msg: 178 if msg:
183 LOG_CONTENT += msg 179 LOG_CONTENT += msg
184 180
185def raw(msg=''):
186 _general_print('', NO_COLOR, msg)
187
188def info(msg): 181def info(msg):
189 head, msg = _split_msg('Info', msg) 182 head, msg = _split_msg('Info', msg)
190 _general_print(head, INFO_COLOR, msg) 183 _general_print(head, INFO_COLOR, msg)
@@ -206,66 +199,6 @@ def error(msg):
206 _color_perror(head, ERR_COLOR, msg) 199 _color_perror(head, ERR_COLOR, msg)
207 sys.exit(1) 200 sys.exit(1)
208 201
209def ask(msg, default=True):
210 _general_print('\rQ', ASK_COLOR, '')
211 try:
212 if default:
213 msg += '(Y/n) '
214 else:
215 msg += '(y/N) '
216 if INTERACTIVE:
217 while True:
218 repl = raw_input(msg)
219 if repl.lower() == 'y':
220 return True
221 elif repl.lower() == 'n':
222 return False
223 elif not repl.strip():
224 # <Enter>
225 return default
226
227 # else loop
228 else:
229 if default:
230 msg += ' Y'
231 else:
232 msg += ' N'
233 _general_print('', NO_COLOR, msg)
234
235 return default
236 except KeyboardInterrupt:
237 sys.stdout.write('\n')
238 sys.exit(2)
239
240def choice(msg, choices, default=0):
241 if default >= len(choices):
242 return None
243 _general_print('\rQ', ASK_COLOR, '')
244 try:
245 msg += " [%s] " % '/'.join(choices)
246 if INTERACTIVE:
247 while True:
248 repl = raw_input(msg)
249 if repl in choices:
250 return repl
251 elif not repl.strip():
252 return choices[default]
253 else:
254 msg += choices[default]
255 _general_print('', NO_COLOR, msg)
256
257 return choices[default]
258 except KeyboardInterrupt:
259 sys.stdout.write('\n')
260 sys.exit(2)
261
262def pause(msg=None):
263 if INTERACTIVE:
264 _general_print('\rQ', ASK_COLOR, '')
265 if msg is None:
266 msg = 'press <ENTER> to continue ...'
267 raw_input(msg)
268
269def set_logfile(fpath): 202def set_logfile(fpath):
270 global LOG_FILE_FP 203 global LOG_FILE_FP
271 204