mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
feat(tools): Added IDF path order check for Windows platform
This relates to old GH issue: https://github.com/espressif/esp-idf/issues/5994
This commit is contained in:
parent
767595a22f
commit
cde207e996
@ -105,6 +105,15 @@ def check_environment() -> List:
|
||||
debug_print_idf_version()
|
||||
raise SystemExit(1)
|
||||
|
||||
# Check used Python interpreter
|
||||
checks_output.append('Checking used Python interpreter...')
|
||||
try:
|
||||
python_venv_path = os.environ['IDF_PYTHON_ENV_PATH']
|
||||
if python_venv_path and not sys.executable.startswith(python_venv_path):
|
||||
print_warning(f'WARNING: Python interpreter "{sys.executable}" used to start idf.py is not from installed venv "{python_venv_path}"')
|
||||
except KeyError:
|
||||
print_warning('WARNING: The IDF_PYTHON_ENV_PATH is missing in environmental variables!')
|
||||
|
||||
return checks_output
|
||||
|
||||
|
||||
|
@ -1802,6 +1802,15 @@ def action_export(args): # type: ignore
|
||||
|
||||
if paths_to_export:
|
||||
export_vars['PATH'] = path_sep.join(to_shell_specific_paths(paths_to_export) + [old_path])
|
||||
# Correct PATH order check for Windows platform
|
||||
# idf-exe has to be before \tools in PATH
|
||||
if sys.platform == 'win32':
|
||||
paths_to_check = rf"{export_vars['PATH']}{os.environ['PATH']}"
|
||||
try:
|
||||
if paths_to_check.index(r'\tools;') < paths_to_check.index(r'\idf-exe'):
|
||||
warn('The PATH is not in correct order (idf-exe should be before esp-idf\\tools)')
|
||||
except ValueError:
|
||||
fatal(f'Both of the directories (..\\idf-exe\\.. and ..\\tools) has to be in the PATH:\n\n{paths_to_check}\n')
|
||||
|
||||
if export_vars:
|
||||
# if not copy of export_vars is given to function, it brekas the formatting string for 'export_statements'
|
||||
|
Loading…
x
Reference in New Issue
Block a user