]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
scripts/build_utils.sh: use "download" instead of "--download" 997/head
authorKefu Chai <kchai@redhat.com>
Sun, 1 Apr 2018 01:18:18 +0000 (09:18 +0800)
committerKefu Chai <kchai@redhat.com>
Sun, 1 Apr 2018 03:23:44 +0000 (11:23 +0800)
"pip install --download" was deprecated since v8.0.0, and was replaced
with "pip download". pip v10.0.0 removed support the "--download"
option. so we need to replace "install --dowload" with "download".

Signed-off-by: Kefu Chai <kchai@redhat.com>
scripts/build_utils.sh

index 66d46b3a46ee81d81434710b317208cd37fbc0eb..e175a10eeef34f8225a7227d868431c65dd90ac8 100644 (file)
@@ -23,6 +23,17 @@ branch_slash_filter() {
     echo $FILTERED_BRANCH
 }
 
+pip_download() {
+    local package=$1
+    shift
+    local options=$@
+    if ! $VENV/pip download $options --dest="$PIP_SDIST_INDEX" $package; then
+        # pip <8.0.0 does not have "download" command
+        $VENV/pip install $options \
+                  --upgrade --exists-action=i --download="$PIP_SDIST_INDEX" \
+                  $package
+    fi
+}
 
 install_python_packages_no_binary () {
     # Use this function to create a virtualenv and install python packages
@@ -48,17 +59,17 @@ install_python_packages_no_binary () {
     mkdir -p $PIP_SDIST_INDEX
 
     echo "Ensuring latest pip is installed"
-    $VENV/pip install --upgrade --exists-action=i --download="$PIP_SDIST_INDEX" pip
+    pip_download pip
     $VENV/pip install --upgrade --exists-action=i --find-links="file://$PIP_SDIST_INDEX" --no-index pip
 
     echo "Updating setuptools"
-    $VENV/pip install --upgrade --exists-action=i --download="$PIP_SDIST_INDEX" setuptools
+    pip_download setuptools
 
     pkgs=("${!1}")
     for package in ${pkgs[@]}; do
         echo $package
         # download packages to the local pip cache
-        $VENV/pip install --no-binary=:all: --upgrade --exists-action=i --download="$PIP_SDIST_INDEX" $package
+        pip_download $package --no-binary=:all:
         # install packages from the local pip cache, ignoring pypi
         $VENV/pip install --no-binary=:all: --upgrade --exists-action=i --find-links="file://$PIP_SDIST_INDEX" --no-index $package
     done
@@ -82,17 +93,18 @@ install_python_packages () {
     mkdir -p $PIP_SDIST_INDEX
 
     echo "Ensuring latest pip is installed"
-    $VENV/pip install --upgrade --exists-action=i --download="$PIP_SDIST_INDEX" pip
+
+    pip_download pip
     $VENV/pip install --upgrade --exists-action=i --find-links="file://$PIP_SDIST_INDEX" --no-index pip
 
     echo "Updating setuptools"
-    $VENV/pip install --upgrade --exists-action=i --download="$PIP_SDIST_INDEX" setuptools
+    pip_download setuptools
 
     pkgs=("${!1}")
     for package in ${pkgs[@]}; do
         echo $package
         # download packages to the local pip cache
-        $VENV/pip install --upgrade --exists-action=i --download="$PIP_SDIST_INDEX" $package
+        pip_download $package
         # install packages from the local pip cache, ignoring pypi
         $VENV/pip install --upgrade --exists-action=i --find-links="file://$PIP_SDIST_INDEX" --no-index $package
     done