Skip to content

[tools] fix menuconfig error on vscode console #8843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions tools/menukconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down
Loading