mirror of
https://github.com/ansible/ansible.git
synced 2026-08-03 08:03:05 +02:00
ansible-test - Fix Python real prefix detection.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
bugfixes:
|
||||
- ansible-test - Fix Python real prefix detection when running in a ``venv`` virtual environment.
|
||||
@@ -5,10 +5,22 @@ __metaclass__ = type
|
||||
import json
|
||||
|
||||
try:
|
||||
# virtualenv <20
|
||||
from sys import real_prefix
|
||||
except ImportError:
|
||||
real_prefix = None
|
||||
|
||||
try:
|
||||
# venv and virtualenv >= 20
|
||||
from sys import base_exec_prefix
|
||||
except ImportError:
|
||||
base_exec_prefix = None
|
||||
|
||||
try:
|
||||
from sys import base_exec_prefix
|
||||
except ImportError:
|
||||
base_exec_prefix = None
|
||||
|
||||
print(json.dumps(dict(
|
||||
real_prefix=real_prefix,
|
||||
real_prefix=real_prefix or base_exec_prefix,
|
||||
)))
|
||||
|
||||
Reference in New Issue
Block a user