mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-08 04:02:27 +00:00
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:
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# coding=utf-8
|
||||
#
|
||||
# SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
|
||||
# SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
@@ -2079,6 +2079,13 @@ def action_install_python_env(args): # type: ignore
|
||||
# Reinstallation of the virtual environment could help if pip was installed for the main Python
|
||||
reinstall = True
|
||||
|
||||
if sys.platform != 'win32':
|
||||
try:
|
||||
subprocess.check_call([virtualenv_python, '-c', 'import curses'], stdout=sys.stdout, stderr=sys.stderr)
|
||||
except subprocess.CalledProcessError:
|
||||
warn('curses can not be imported, new virtual environment will be created.')
|
||||
reinstall = True
|
||||
|
||||
if reinstall and os.path.exists(idf_python_env_path):
|
||||
warn('Removing the existing Python environment in {}'.format(idf_python_env_path))
|
||||
shutil.rmtree(idf_python_env_path)
|
||||
|
Reference in New Issue
Block a user