Skip to content

Commit

Permalink
fix(tools): venv detection use VIRTUAL_ENV environ
Browse files Browse the repository at this point in the history
To fix #12036
This is required for Nix "venv"-like way.
  • Loading branch information
nim65s committed Aug 24, 2024
1 parent d7ca8b9 commit c25b563
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tools/idf_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2573,7 +2573,7 @@ def action_install_python_env(args): # type: ignore
reinstall = args.reinstall
idf_python_env_path, _, virtualenv_python, idf_version = get_python_env_path()

is_virtualenv = hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix)
is_virtualenv = 'VIRTUAL_ENV' in os.environ
if is_virtualenv and (not os.path.exists(idf_python_env_path) or reinstall):
fatal('This script was called from a virtual environment, can not create a virtual environment again')
raise SystemExit(1)
Expand Down

0 comments on commit c25b563

Please sign in to comment.