diff --git a/functions-common b/functions-common index 40a0d2b942..30f99ba3e9 100644 --- a/functions-common +++ b/functions-common @@ -26,7 +26,6 @@ # - ``ERROR_ON_CLONE`` # - ``FILES`` # - ``OFFLINE`` -# - ``PIP_DOWNLOAD_CACHE`` # - ``RECLONE`` # - ``REQUIREMENTS_DIR`` # - ``STACK_USER`` @@ -1555,8 +1554,7 @@ function get_python_exec_prefix { } # Wrapper for ``pip install`` to set cache and proxy environment variables -# Uses globals ``OFFLINE``, ``PIP_DOWNLOAD_CACHE``, -# ``TRACK_DEPENDS``, ``*_proxy`` +# Uses globals ``OFFLINE``, ``TRACK_DEPENDS``, ``*_proxy`` # pip_install package [package ...] function pip_install { local xtrace=$(set +o | grep xtrace) @@ -1581,8 +1579,15 @@ function pip_install { local sudo_pip="sudo -H" fi + local pip_version=$(python -c "import pip; \ + print(pip.__version__.strip('.')[0])") + if (( pip_version<6 )); then + die $LINENO "Currently installed pip version ${pip_version} does not" \ + "meet minimum requirements (>=6)." + fi + $xtrace - $sudo_pip PIP_DOWNLOAD_CACHE=${PIP_DOWNLOAD_CACHE:-/var/cache/pip} \ + $sudo_pip \ http_proxy=$http_proxy \ https_proxy=$https_proxy \ no_proxy=$no_proxy \ @@ -1593,7 +1598,7 @@ function pip_install { if [[ "$INSTALL_TESTONLY_PACKAGES" == "True" ]]; then local test_req="$@/test-requirements.txt" if [[ -e "$test_req" ]]; then - $sudo_pip PIP_DOWNLOAD_CACHE=${PIP_DOWNLOAD_CACHE:-/var/cache/pip} \ + $sudo_pip \ http_proxy=$http_proxy \ https_proxy=$https_proxy \ no_proxy=$no_proxy \