tree-wide: Remove redundant setlocale's
This commit also fixes the confirm method to repeat asking until a valid input is given.
This commit is contained in:
@@ -12,7 +12,6 @@
|
||||
|
||||
import sys
|
||||
import errno
|
||||
import locale
|
||||
import traceback
|
||||
import exceptions
|
||||
import signal
|
||||
@@ -79,6 +78,5 @@ if __name__ == "__main__":
|
||||
|
||||
signal.signal(signal.SIGTERM, sig_handler)
|
||||
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
cli = pisicli.PisiCLI()
|
||||
cli.run_command()
|
||||
|
||||
+13
-6
@@ -137,7 +137,6 @@ class CLI(pisi.ui.UI):
|
||||
|
||||
def choose(self, msg, opts):
|
||||
msg = unicode(msg)
|
||||
import re
|
||||
prompt = msg + pisi.util.colorize(' (%s)' % "/".join(opts), 'red')
|
||||
while True:
|
||||
s = raw_input(prompt.encode('utf-8'))
|
||||
@@ -149,17 +148,25 @@ class CLI(pisi.ui.UI):
|
||||
msg = unicode(msg)
|
||||
if ctx.config.options and ctx.config.options.yes_all:
|
||||
return True
|
||||
while True:
|
||||
import re, tty
|
||||
yesexpr = re.compile(locale.nl_langinfo(locale.YESEXPR))
|
||||
|
||||
import re, tty
|
||||
|
||||
locale.setlocale(locale.LC_ALL, "")
|
||||
yes_expr = re.compile(locale.nl_langinfo(locale.YESEXPR))
|
||||
no_expr = re.compile(locale.nl_langinfo(locale.NOEXPR))
|
||||
locale.setlocale(locale.LC_ALL, "C")
|
||||
|
||||
while True:
|
||||
tty.tcflush(sys.stdin.fileno(), 0)
|
||||
prompt = msg + pisi.util.colorize(_(' (yes/no)'), 'red')
|
||||
s = raw_input(prompt.encode('utf-8'))
|
||||
if yesexpr.search(s):
|
||||
|
||||
if yes_expr.search(s):
|
||||
return True
|
||||
|
||||
return False
|
||||
if no_expr.search(s):
|
||||
return False
|
||||
|
||||
|
||||
def display_progress(self, **ka):
|
||||
""" display progress of any operation """
|
||||
|
||||
@@ -18,7 +18,6 @@ import glob
|
||||
import stat
|
||||
import pwd
|
||||
import grp
|
||||
import locale
|
||||
import fnmatch
|
||||
|
||||
import gettext
|
||||
@@ -910,7 +909,6 @@ class Builder:
|
||||
def file_actions(self):
|
||||
install_dir = self.pkg_install_dir()
|
||||
|
||||
locale.setlocale(locale.LC_ALL, 'C')
|
||||
import magic
|
||||
ms = magic.open(magic.MAGIC_NONE)
|
||||
ms.load()
|
||||
@@ -923,7 +921,6 @@ class Builder:
|
||||
exclude_special_files(filepath, fileinfo, self.actionGlobals)
|
||||
|
||||
ms.close()
|
||||
locale.setlocale(locale.LC_ALL, '')
|
||||
|
||||
def build_packages(self):
|
||||
"""Build each package defined in PSPEC file. After this process there
|
||||
|
||||
Reference in New Issue
Block a user