mirror of https://github.com/ansible/ansible.git
Work around virtualenv/venv issue in ansible-test. (#62111)
Creating a virtual environment using `venv` when running in a virtual environment created by `virtualenv` results in a copy of the original virtual environment instead of creation of a new one. To work around this, `ansible-test` now identifies when it is running in a `virtualenv` created virtual environment and uses the real Python interpreter to create the `venv` virtual environment.pull/59974/head
parent
cd8161a948
commit
a7bc11ce67
@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- ansible-test now properly creates a virtual environment using ``venv`` when running in a ``virtualenv`` created virtual environment
|
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env python
|
||||
"""Detect the real python interpreter when running in a virtual environment created by the 'virtualenv' module."""
|
||||
from __future__ import (absolute_import, division, print_function)
|
||||
__metaclass__ = type
|
||||
|
||||
import json
|
||||
import os
|
||||
|
||||
try:
|
||||
from sys import real_prefix
|
||||
except ImportError:
|
||||
real_prefix = None
|
||||
|
||||
print(json.dumps(dict(
|
||||
real_prefix=real_prefix,
|
||||
)))
|
Loading…
Reference in New Issue