Use Python 3 for running httpbin in non-Trusty Linux CI builds

Even Ubuntu 16.04 has Python 3 and pip3, so just use them instead of
trying to work around problems with Python 2.
This commit is contained in:
Vadim Zeitlin
2021-04-04 00:29:27 +02:00
parent 2b89215eec
commit da0f6bd2a6

View File

@@ -9,28 +9,38 @@ httpbin_launch() {
Linux) Linux)
dist_codename=$(lsb_release --codename --short) dist_codename=$(lsb_release --codename --short)
;; ;;
Darwin)
dist_codename='macOS'
;;
esac esac
# We need to disable SSL certificate checking under Trusty because Python
# version there is too old to support SNI.
case "$dist_codename" in case "$dist_codename" in
trusty) trusty)
# Here "decorator==4.4.2" doesn't work neither for some reason ("no # Current decorator (>= 5) is incompatible with Python 2 which we
# matching distribution found"), so use an explicit URL. # still use in some builds, so explicitly use a version which
# is known to work. Just specifying "decorator==4.4.2" doesn't work
# neither for some reason ("no matching distribution found"), so
# use an explicit URL.
pip_decorator_arg='https://files.pythonhosted.org/packages/ed/1b/72a1821152d07cf1d8b6fce298aeb06a7eb90f4d6d41acec9861e7cc6df0/decorator-4.4.2-py2.py3-none-any.whl' pip_decorator_arg='https://files.pythonhosted.org/packages/ed/1b/72a1821152d07cf1d8b6fce298aeb06a7eb90f4d6d41acec9861e7cc6df0/decorator-4.4.2-py2.py3-none-any.whl'
# We need to disable SSL certificate checking under Trusty because
# Python version there is too old to support SNI.
pip_options='--trusted-host files.pythonhosted.org' pip_options='--trusted-host files.pythonhosted.org'
;; ;;
*) macOS)
# Current decorator (>= 5) is incompatible with Python 2 which we
# still use under in some builds, so explicitly use a version which
# is known to work.
pip_decorator_arg='decorator==4.4.2' pip_decorator_arg='decorator==4.4.2'
;; ;;
*)
# Elsewhere just use Python 3.
PY3=3
;;
esac esac
pip install $pip_decorator_arg httpbin --user $pip_options python$PY3 -m pip install $pip_decorator_arg httpbin --user $pip_options
python -m httpbin.core 2>&1 >httpbin.log & python$PY3 -m httpbin.core 2>&1 >httpbin.log &
WX_TEST_WEBREQUEST_URL="http://localhost:5000" WX_TEST_WEBREQUEST_URL="http://localhost:5000"
export WX_TEST_WEBREQUEST_URL export WX_TEST_WEBREQUEST_URL