Fix ansible-test virtualenv management.

pull/70637/head
Matt Clay 4 years ago
parent 09f02980a4
commit 1e02a201a6

@ -0,0 +1,2 @@
bugfixes:
- ansible-test now always uses the ``--python`` option for ``virtualenv`` to select the correct interpreter when creating environments with the ``--venv`` option

@ -173,10 +173,9 @@ def run_virtualenv(args, # type: EnvironmentConfig
path, # type: str
): # type: (...) -> bool
"""Create a virtual environment using the 'virtualenv' module."""
cmd = [run_python, '-m', 'virtualenv']
if run_python != env_python:
cmd += ['--python', env_python]
# always specify --python to guarantee the desired interpreter is provided
# otherwise virtualenv may select a different interpreter than the one running virtualenv
cmd = [run_python, '-m', 'virtualenv', '--python', env_python]
if system_site_packages:
cmd.append('--system-site-packages')

Loading…
Cancel
Save