From 6ce071b796d7bbf851df225ca7097d2de26b3456 Mon Sep 17 00:00:00 2001 From: Radoslaw Smigielski Date: Tue, 13 Jan 2015 06:29:31 +0000 Subject: [PATCH] Depreciated pip option PIP_DOWNLOAD_CACHE removal Fix warning: DEPRECATION: --download-cache has been deprecated and will be removed in the future. Pip now automatically uses and configures its cache. 1. Since version 6.0 (2014-12-22) pip has deprecated PIP_DOWNLOAD_CACHE and now automatically uses and configures its cache. Default new location is $HOME/.cache/pip. 2. pip gets upgraded to the latest version in tools/install_pip.sh but if pip version<6, exit with error: "Currently installed pip version ${pip_version} does not meet meet minimum requirements" Change-Id: I8b203ffc6d9cf588462d0d65a9703a9941d8fa71 --- functions-common | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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 \