mirror of
https://github.com/espressif/esp-idf
synced 2025-03-08 23:59:08 -05:00
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 <frantisek.hrbata@espressif.com>
This commit is contained in:
parent
1f4ea21092
commit
c0954cf0b2
@ -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()
|
||||
|
||||
@ -39,10 +38,12 @@ 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, env=os.environ.copy())
|
||||
except (OSError, SubprocessError):
|
||||
die('\n'.join(['Activation script failed',
|
||||
except (OSError, SubprocessError) as e:
|
||||
die('\n'.join(['Activation script failed', str(e),
|
||||
'To view detailed debug information, set ESP_IDF_EXPORT_DEBUG=1 and run the export script again.']))
|
||||
|
Loading…
x
Reference in New Issue
Block a user