diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 16:04:21 +0000 |
commit | 8a754e0858d922e955e71b253c139e071ecec432 (patch) | |
tree | 527d16e74bfd1840c85efd675fdecad056c54107 /test/integration/targets/ansible-test | |
parent | Initial commit. (diff) | |
download | ansible-core-8a754e0858d922e955e71b253c139e071ecec432.tar.xz ansible-core-8a754e0858d922e955e71b253c139e071ecec432.zip |
Adding upstream version 2.14.3.upstream/2.14.3upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/integration/targets/ansible-test')
-rw-r--r-- | test/integration/targets/ansible-test/aliases | 1 | ||||
-rwxr-xr-x | test/integration/targets/ansible-test/venv-pythons.py | 42 |
2 files changed, 43 insertions, 0 deletions
diff --git a/test/integration/targets/ansible-test/aliases b/test/integration/targets/ansible-test/aliases new file mode 100644 index 0000000..136c05e --- /dev/null +++ b/test/integration/targets/ansible-test/aliases @@ -0,0 +1 @@ +hidden diff --git a/test/integration/targets/ansible-test/venv-pythons.py b/test/integration/targets/ansible-test/venv-pythons.py new file mode 100755 index 0000000..b380f14 --- /dev/null +++ b/test/integration/targets/ansible-test/venv-pythons.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python +"""Return target Python options for use with ansible-test.""" + +import os +import shutil +import subprocess +import sys + +from ansible import release + + +def main(): + ansible_root = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(release.__file__)))) + source_root = os.path.join(ansible_root, 'test', 'lib') + + sys.path.insert(0, source_root) + + from ansible_test._internal import constants + + args = [] + + for python_version in constants.SUPPORTED_PYTHON_VERSIONS: + executable = shutil.which(f'python{python_version}') + + if executable: + if python_version.startswith('2.'): + cmd = [executable, '-m', 'virtualenv', '--version'] + else: + cmd = [executable, '-m', 'venv', '--help'] + + process = subprocess.run(cmd, capture_output=True, check=False) + + print(f'{executable} - {"fail" if process.returncode else "pass"}', file=sys.stderr) + + if not process.returncode: + args.extend(['--target-python', f'venv/{python_version}']) + + print(' '.join(args)) + + +if __name__ == '__main__': + main() |