Debian Codegraph @

test/integration/targets/entry_points/runme.sh

raw
1 #!/usr/bin/env bash
2
3 set -eu -o pipefail
4
5 function check_entry_points() {
6 bin_dir="$(dirname "$(command -v pip)")"
7
8 for bin in "${bin_dir}/ansible"*; do
9 name="$(basename "${bin}")"
10
11 entry_point="${name//ansible-/}"
12 entry_point="${entry_point//ansible/adhoc}"
13
14 echo "=== ${name} (${entry_point})=${bin} ==="
15
16 if [ "${name}" == "ansible-test" ]; then
17 "${bin}" --help | tee /dev/stderr | grep -Eo "^usage:\ ansible-test\ .*"
18 python.py -m ansible "${entry_point}" --help | tee /dev/stderr | grep -Eo "^usage:\ ansible-test\ .*"
19 else
20 "${bin}" --version | tee /dev/stderr | grep -Eo "(^${name}\ \[core\ .*|executable location = ${bin}$)"
21 python.py -m ansible "${entry_point}" --version | tee /dev/stderr | grep -Eo "(^${name}\ \[core\ .*|executable location = ${bin}$)"
22 fi
23 done
24 }
25
26 source virtualenv.sh
27 set +x
28 unset PYTHONPATH # this causes the test to fail if it was started from an existing virtual environment
29
30 base_dir="$(dirname "$(dirname "$(dirname "$(dirname "${OUTPUT_DIR}")")")")"
31
32 # deps are already installed, using --no-deps to avoid re-installing them
33 pip_options=(--disable-pip-version-check --no-deps)
34
35 echo "==> check entry points using an editable install"
36
37 pip install -e "${base_dir}" "${pip_options[@]}"
38 check_entry_points
39 pip uninstall -y ansible-core
40
41 echo "==> check entry points using a normal install"
42
43 pip install "${base_dir}" "${pip_options[@]}"
44 check_entry_points
45 pip uninstall -y ansible-core