Fix ansible-test PATH handling. (#69407)

(cherry picked from commit f1b3e8364e)

Co-authored-by: Matt Clay <matt@mystile.com>
pull/69999/head
Felix Fontein 6 years ago committed by GitHub
parent b8808efd26
commit 6280bd7af2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,3 @@
bugfixes:
- ansible-test no longer optimizes setting ``PATH`` by prepending the directory containing the selected Python interpreter when it is named ``python``.
This avoids unintentionally making other programs available on ``PATH``, including an already installed version of Ansible.

@ -171,11 +171,6 @@ def get_python_path(args, interpreter):
:type interpreter: str
:rtype: str
"""
# When the python interpreter is already named "python" its directory can simply be added to the path.
# Using another level of indirection is only required when the interpreter has a different name.
if os.path.basename(interpreter) == 'python':
return os.path.dirname(interpreter)
python_path = PYTHON_PATHS.get(interpreter)
if python_path:

Loading…
Cancel
Save