mirror of https://github.com/ansible/ansible.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
518 B
Python
22 lines
518 B
Python
5 years ago
|
"""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
|
||
|
|
||
|
try:
|
||
3 years ago
|
# virtualenv <20
|
||
5 years ago
|
from sys import real_prefix
|
||
|
except ImportError:
|
||
|
real_prefix = None
|
||
|
|
||
3 years ago
|
try:
|
||
|
# venv and virtualenv >= 20
|
||
|
from sys import base_exec_prefix
|
||
|
except ImportError:
|
||
|
base_exec_prefix = None
|
||
|
|
||
5 years ago
|
print(json.dumps(dict(
|
||
3 years ago
|
real_prefix=real_prefix or base_exec_prefix,
|
||
5 years ago
|
)))
|