a7bc11ce67
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.
16 lines
386 B
Python
Executable file
16 lines
386 B
Python
Executable file
#!/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,
|
|
)))
|