diff --git a/test/integration/targets/entry_points/runme.sh b/test/integration/targets/entry_points/runme.sh index f8d6fe5f17f..a376a267117 100755 --- a/test/integration/targets/entry_points/runme.sh +++ b/test/integration/targets/entry_points/runme.sh @@ -1,30 +1,45 @@ #!/usr/bin/env bash set -eu -o pipefail + +function check_entry_points() { + bin_dir="$(dirname "$(command -v pip)")" + + for bin in "${bin_dir}/ansible"*; do + name="$(basename "${bin}")" + + entry_point="${name//ansible-/}" + entry_point="${entry_point//ansible/adhoc}" + + echo "=== ${name} (${entry_point})=${bin} ===" + + if [ "${name}" == "ansible-test" ]; then + "${bin}" --help | tee /dev/stderr | grep -Eo "^usage:\ ansible-test\ .*" + python.py -m ansible "${entry_point}" --help | tee /dev/stderr | grep -Eo "^usage:\ ansible-test\ .*" + else + "${bin}" --version | tee /dev/stderr | grep -Eo "(^${name}\ \[core\ .*|executable location = ${bin}$)" + python.py -m ansible "${entry_point}" --version | tee /dev/stderr | grep -Eo "(^${name}\ \[core\ .*|executable location = ${bin}$)" + fi + done +} + source virtualenv.sh set +x -unset PYTHONPATH +unset PYTHONPATH # this causes the test to fail if it was started from an existing virtual environment base_dir="$(dirname "$(dirname "$(dirname "$(dirname "${OUTPUT_DIR}")")")")" -bin_dir="$(dirname "$(command -v pip)")" # deps are already installed, using --no-deps to avoid re-installing them -pip install "${base_dir}" --disable-pip-version-check --no-deps -# --use-feature=in-tree-build not available on all platforms +pip_options=(--disable-pip-version-check --no-deps) -for bin in "${bin_dir}/ansible"*; do - name="$(basename "${bin}")" +echo "==> check entry points using an editable install" - entry_point="${name//ansible-/}" - entry_point="${entry_point//ansible/adhoc}" +pip install -e "${base_dir}" "${pip_options[@]}" +check_entry_points +pip uninstall -y ansible-core - echo "=== ${name} (${entry_point})=${bin} ===" +echo "==> check entry points using a normal install" - if [ "${name}" == "ansible-test" ]; then - "${bin}" --help | tee /dev/stderr | grep -Eo "^usage:\ ansible-test\ .*" - python -m ansible "${entry_point}" --help | tee /dev/stderr | grep -Eo "^usage:\ ansible-test\ .*" - else - "${bin}" --version | tee /dev/stderr | grep -Eo "(^${name}\ \[core\ .*|executable location = ${bin}$)" - python -m ansible "${entry_point}" --version | tee /dev/stderr | grep -Eo "(^${name}\ \[core\ .*|executable location = ${bin}$)" - fi -done +pip install "${base_dir}" "${pip_options[@]}" +check_entry_points +pip uninstall -y ansible-core