From a87fe7aa3a46c587af43c669ad62355da4d35647 Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Tue, 10 Dec 2024 08:48:43 +0100 Subject: [PATCH] fix(tools): honor IDF_PYTHON_ENV_PATH value The active.py script is currently clearing the IDF_PYTHON_ENV_PATH, preventing it from being set to a custom location for the python virtual environment directory. Although the install script checks to ensure that an existing python virtual environment is not overwritten with one for a different ESP-IDF version than it was originally created for, we should still permit setting a custom path for the python virtual environment. Closes https://github.com/espressif/esp-idf/issues/15006 Signed-off-by: Frantisek Hrbata --- tools/activate.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/activate.py b/tools/activate.py index d1f88e34ad..efa3c024ed 100755 --- a/tools/activate.py +++ b/tools/activate.py @@ -29,7 +29,6 @@ except ImportError as e: # Get ESP-IDF venv python path idf_tools.g.idf_path = idf_path -os.environ['IDF_PYTHON_ENV_PATH'] = '' # let idf_tools get the pyenv path idf_tools.g.idf_tools_path = os.environ.get('IDF_TOOLS_PATH') or os.path.expanduser(idf_tools.IDF_TOOLS_PATH_DEFAULT) idf_python_env_path, idf_python_export_path, virtualenv_python, idf_version = idf_tools.get_python_env_path() @@ -38,7 +37,9 @@ os.environ['IDF_PYTHON_ENV_PATH'] = idf_python_env_path os.environ['ESP_IDF_VERSION'] = idf_version if not os.path.exists(virtualenv_python): - die(f'ESP-IDF Python virtual environment not found. Please run the install script to set it up before proceeding.') + die((f'ESP-IDF Python virtual environment "{virtualenv_python}" ' + f'not found. Please run the install script to set it up before ' + f'proceeding.')) try: run([virtualenv_python, os.path.join(idf_path, 'tools', 'export_utils', 'activate_venv.py')] + sys.argv[1:], check=True)