Skip to content

Commit

Permalink
Merge branch 'fix/nix_python_compatibility' into 'master'
Browse files Browse the repository at this point in the history
fix(tools): Nix python compatibility fix

Closes IDFGH-13545

See merge request espressif/esp-idf!33128
  • Loading branch information
dobairoland committed Oct 22, 2024
2 parents 93a9368 + c6bd0de commit 4ab9a31
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tools/idf_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2574,7 +2574,10 @@ 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)
nix_store = os.environ.get('NIX_STORE')
is_nix = nix_store is not None and sys.base_prefix.startswith(nix_store) and sys.prefix.startswith(nix_store)

is_virtualenv = not is_nix and (hasattr(sys, 'real_prefix') or (hasattr(sys, 'base_prefix') and sys.base_prefix != sys.prefix))
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 4ab9a31

Please sign in to comment.