Merge branch 'fix/idf_tools_venv_check_v5.0' into 'release/v5.0'

Tools: Check venv the same way how it will be used later (v5.0)

See merge request espressif/esp-idf!20544
This commit is contained in:
Roland Dobai
2022-12-02 19:10:33 +08:00

View File

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