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