X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=blobdiff_plain;f=shell%2Fpip-install.sh;fp=shell%2Fpip-install.sh;h=b2aacfe87a42ddcfe1c66a8094797fc61869790a;hb=3eafac9054bf588d14eefe4c72d0e9034b8ce6e6;hp=0000000000000000000000000000000000000000;hpb=d5dd1678d8da13ed05a68d566b9b7da13a4b04a9;p=releng%2Fglobal-jjb.git diff --git a/shell/pip-install.sh b/shell/pip-install.sh new file mode 100644 index 00000000..b2aacfe8 --- /dev/null +++ b/shell/pip-install.sh @@ -0,0 +1,35 @@ +#!/bin/bash +# SPDX-License-Identifier: EPL-1.0 +############################################################################## +# Copyright (c) 2017 The Linux Foundation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +############################################################################## +# pip install packages into a virtualenv using the first listed package as venv name +# +# PIP_PACKAGES is a space separated list of pypi packages to install. The first +# listed package is used as the virtualenv directory name. +echo "---> pip-install.sh" + +# Ensure we fail the job if any steps fail. +# DO NOT set -u as virtualenv's activate script has unbound variables +set -e -o pipefail + +# Install git-review using virtualenv to the latest version that supports +# --reviewers option, available through pip install. Existing minion image has a +# version that does not have it. +virtualenv "/tmp/v/${PIP_PACKAGES%% *}" +# shellcheck source=/tmp/v/venv/bin/activate disable=SC1091 +source "/tmp/v/${PIP_PACKAGES%% *}/bin/activate" +pip install --quiet --upgrade pip +pip install --quiet --upgrade pipdeptree + +# PIP_PACKAGES needs to be passed through as a space separated list of packages +# shellcheck disable=SC2086 +pip install --upgrade $PIP_PACKAGES + +echo "----> Pip Dependency Tree" +pipdeptree