diff options
author | Matt Clay <matt@mystile.com> | 2021-10-21 14:55:01 -0700 |
---|---|---|
committer | Matt Clay <matt@mystile.com> | 2021-10-21 15:28:48 -0700 |
commit | b4cbe1adcf628981eb2b67f51c9af09e46a39d8a (patch) | |
tree | 227c138c1a64cc67451174783dc95a61133b2bf0 /test | |
parent | 0bf7b3f4efdf9b1aac2510e641076d3e673f00a6 (diff) | |
download | ansible-b4cbe1adcf628981eb2b67f51c9af09e46a39d8a.tar.gz |
ansible-test - Fix Python real prefix detection.
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/ansible_test/_util/controller/tools/virtualenvcheck.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/lib/ansible_test/_util/controller/tools/virtualenvcheck.py b/test/lib/ansible_test/_util/controller/tools/virtualenvcheck.py index 90dfa39410..4c542a23fd 100644 --- a/test/lib/ansible_test/_util/controller/tools/virtualenvcheck.py +++ b/test/lib/ansible_test/_util/controller/tools/virtualenvcheck.py @@ -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, ))) |