From 0c79d2332c85123b5f83be8fa06d5ce5cb261f4e Mon Sep 17 00:00:00 2001 From: Ulf Magnusson Date: Sat, 15 Jun 2019 21:36:43 +0200 Subject: menuconfig: Be silent when changing LC_CTYPE to a UTF-8 locale Having LC_ALL=C and the like in Makefiles is probably pretty common, to get consistent collation and messages from commands and stuff. It currently makes menuconfig.py spit out a warning about changing the locale to a UTF-8 locale though. Just remove the message, and silently change the locale. The Python 3.7 PEP 538 code is silent as well. --- menuconfig.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/menuconfig.py b/menuconfig.py index cfcfbef..9525826 100755 --- a/menuconfig.py +++ b/menuconfig.py @@ -3245,15 +3245,13 @@ def _convert_c_lc_ctype_to_utf8(): return False # Is LC_CTYPE set to the C locale? - if locale.setlocale(locale.LC_CTYPE, None) == "C": + if locale.setlocale(locale.LC_CTYPE) == "C": # This list was taken from the PEP 538 implementation in the CPython # code, in Python/pylifecycle.c for loc in "C.UTF-8", "C.utf8", "UTF-8": if try_set_locale(loc): - print("Note: Your environment is configured to use ASCII. To " - "avoid Unicode issues, LC_CTYPE was changed from the " - "C locale to the {} locale.".format(loc)) - break + # LC_CTYPE successfully changed + return # Are we running on Windows? -- cgit v1.2.3