ansible-test - Fix Python real prefix detection.

pull/76120/head
Matt Clay 3 years ago
parent 0bf7b3f4ef
commit b4cbe1adcf

@ -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,
)))

Loading…
Cancel
Save