summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShell <[email protected]>2024-04-23 23:08:57 +0800
committerGitHub <[email protected]>2024-04-23 23:08:57 +0800
commitee8c61126daeae8e74727462c6446a57b27bb5b9 (patch)
tree5911628fdde5e75afa145b33dbaf6a4e03d4044b
parent184bfb447b77bfc04fcf3485281fa1ae87170363 (diff)
[tools] fix menuconfig error on vscode console (#8843)
Signed-off-by: Shell <[email protected]>
-rw-r--r--tools/menukconfig.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tools/menukconfig.py b/tools/menukconfig.py
index d31c9dc173..337b60640a 100644
--- a/tools/menukconfig.py
+++ b/tools/menukconfig.py
@@ -243,6 +243,18 @@ def exclude_utestcases(RTT_ROOT):
if line.find('examples/utest/testcases/Kconfig') == -1:
f.write(line)
+# fix locale for kconfiglib
+def kconfiglib_fix_locale():
+ import os
+ import locale
+
+ # Get the list of supported locales
+ supported_locales = set(locale.locale_alias.keys())
+
+ # Check if LANG is set and its value is not in the supported locales
+ if 'LANG' in os.environ and os.environ['LANG'] not in supported_locales:
+ os.environ['LANG'] = 'C'
+
# menuconfig for Linux and Windows
def menuconfig(RTT_ROOT):
import menuconfig
@@ -261,6 +273,10 @@ def menuconfig(RTT_ROOT):
fn_old = '.config.old'
sys.argv = ['menuconfig', 'Kconfig']
+
+ # fix vscode console
+ kconfiglib_fix_locale()
+
menuconfig._main()
if os.path.isfile(fn):