fix(tools): Tool curses import check

Verify that curses tool can be successfully imported on unix systems

When detected:
- installing esp-idf -> reinstall python environment
- using idf.py menuconfig -> raise error with hint message

Closes https://github.com/espressif/esp-idf/issues/11643
This commit is contained in:
Marek Fiala
2023-06-28 10:44:27 +02:00
committed by BOT
parent 5995cab9c1
commit 206c46325a
3 changed files with 16 additions and 2 deletions

View File

@@ -62,6 +62,13 @@ def action_extensions(base_actions: Dict, project_path: str) -> Any:
Menuconfig target is build_target extended with the style argument for setting the value for the environment
variable.
"""
if sys.platform != 'win32':
try:
import curses # noqa: F401
except ImportError:
raise FatalError('\n'.join(
['', "menuconfig failed to import the standard Python 'curses' library.",
'Please re-run the install script which might be able to fix the issue.']))
if sys.version_info[0] < 3:
# The subprocess lib cannot accept environment variables as "unicode".
# This encoding step is required only in Python 2.