Skip to content

Commit

Permalink
Merge branch 'fix/idf_tools_venv_check' into 'master'
Browse files Browse the repository at this point in the history
Tools: Check venv the same way how it will be used later

See merge request espressif/esp-idf!20525
  • Loading branch information
dobairoland committed Oct 11, 2022
2 parents 0cf1477 + 404612b commit cd8f4c7
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tools/idf_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -2007,9 +2007,7 @@ def action_install_python_env(args): # type: ignore
venv_can_upgrade = False

if not os.path.exists(virtualenv_python):
try:
import venv # noqa: F401

if subprocess.run([sys.executable, '-m', 'venv', '-h'], check=False, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode == 0:
# venv available
virtualenv_options = ['--clear'] # delete environment if already exists
if sys.version_info[:2] >= (3, 9):
Expand All @@ -2022,7 +2020,7 @@ def action_install_python_env(args): # type: ignore
*virtualenv_options,
idf_python_env_path],
stdout=sys.stdout, stderr=sys.stderr)
except ImportError:
else:
# The embeddable Python for Windows doesn't have the built-in venv module
install_legacy_python_virtualenv(idf_python_env_path)

Expand Down

0 comments on commit cd8f4c7

Please sign in to comment.