mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
Tools: Check venv the same way how it will be used later
It is possible that import of venv passes but it still cannot be started. This can happen with the embedded Python deployed by the ESP-IDF installer.
This commit is contained in:
parent
d1dee58be5
commit
404612b130
@ -2007,9 +2007,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):
|
||||||
@ -2022,7 +2020,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)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user