From 484e4af4d0b0f8ba88f73c20f592bb107eb9396a Mon Sep 17 00:00:00 2001 From: Matt Clay Date: Sat, 23 Jan 2021 10:39:40 -0800 Subject: [PATCH] Handle get-pip.py breaking change on Python 2.7. --- changelogs/fragments/ansible-test-pip-bootstrap.yml | 2 ++ test/lib/ansible_test/_data/setup/remote.sh | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/ansible-test-pip-bootstrap.yml diff --git a/changelogs/fragments/ansible-test-pip-bootstrap.yml b/changelogs/fragments/ansible-test-pip-bootstrap.yml new file mode 100644 index 00000000000..d9322116bf6 --- /dev/null +++ b/changelogs/fragments/ansible-test-pip-bootstrap.yml @@ -0,0 +1,2 @@ +bugfixes: + - ansible-test - The ``--remote`` option has been updated for Python 2.7 to work around breaking changes in the newly released ``get-pip.py`` bootstrapper. diff --git a/test/lib/ansible_test/_data/setup/remote.sh b/test/lib/ansible_test/_data/setup/remote.sh index a08b3492294..05cb7c6061d 100644 --- a/test/lib/ansible_test/_data/setup/remote.sh +++ b/test/lib/ansible_test/_data/setup/remote.sh @@ -10,7 +10,15 @@ cd ~/ install_pip () { if ! "${python_interpreter}" -m pip.__main__ --version --disable-pip-version-check 2>/dev/null; then - curl --silent --show-error https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py + case "${python_version}" in + "2.7") + pip_bootstrap_url="https://bootstrap.pypa.io/${python_version}/get-pip.py" + ;; + *) + pip_bootstrap_url="https://bootstrap.pypa.io/get-pip.py" + ;; + esac + curl --silent --show-error "${pip_bootstrap_url}" -o /tmp/get-pip.py "${python_interpreter}" /tmp/get-pip.py --disable-pip-version-check --quiet rm /tmp/get-pip.py fi