Browse code

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

Radoslaw Smigielski authored on 2015/01/13 15:29:31
Showing 1 changed files
... ...
@@ -26,7 +26,6 @@
26 26
 # - ``ERROR_ON_CLONE``
27 27
 # - ``FILES``
28 28
 # - ``OFFLINE``
29
-# - ``PIP_DOWNLOAD_CACHE``
30 29
 # - ``RECLONE``
31 30
 # - ``REQUIREMENTS_DIR``
32 31
 # - ``STACK_USER``
... ...
@@ -1555,8 +1554,7 @@ function get_python_exec_prefix {
1555 1555
 }
1556 1556
 
1557 1557
 # Wrapper for ``pip install`` to set cache and proxy environment variables
1558
-# Uses globals ``OFFLINE``, ``PIP_DOWNLOAD_CACHE``,
1559
-# ``TRACK_DEPENDS``, ``*_proxy``
1558
+# Uses globals ``OFFLINE``, ``TRACK_DEPENDS``, ``*_proxy``
1560 1559
 # pip_install package [package ...]
1561 1560
 function pip_install {
1562 1561
     local xtrace=$(set +o | grep xtrace)
... ...
@@ -1581,8 +1579,15 @@ function pip_install {
1581 1581
         local sudo_pip="sudo -H"
1582 1582
     fi
1583 1583
 
1584
+    local pip_version=$(python -c "import pip; \
1585
+                        print(pip.__version__.strip('.')[0])")
1586
+    if (( pip_version<6 )); then
1587
+        die $LINENO "Currently installed pip version ${pip_version} does not" \
1588
+            "meet minimum requirements (>=6)."
1589
+    fi
1590
+
1584 1591
     $xtrace
1585
-    $sudo_pip PIP_DOWNLOAD_CACHE=${PIP_DOWNLOAD_CACHE:-/var/cache/pip} \
1592
+    $sudo_pip \
1586 1593
         http_proxy=$http_proxy \
1587 1594
         https_proxy=$https_proxy \
1588 1595
         no_proxy=$no_proxy \
... ...
@@ -1593,7 +1598,7 @@ function pip_install {
1593 1593
     if [[ "$INSTALL_TESTONLY_PACKAGES" == "True" ]]; then
1594 1594
         local test_req="$@/test-requirements.txt"
1595 1595
         if [[ -e "$test_req" ]]; then
1596
-            $sudo_pip PIP_DOWNLOAD_CACHE=${PIP_DOWNLOAD_CACHE:-/var/cache/pip} \
1596
+            $sudo_pip \
1597 1597
                 http_proxy=$http_proxy \
1598 1598
                 https_proxy=$https_proxy \
1599 1599
                 no_proxy=$no_proxy \