devstack/tools/install_pip.sh
Sean Dague 7b63c5ec9e be opinionated: only use get-pip.py
get-pip.py is now on a CDN, and is the prefered way to get pip.

Remove the default path of using pip tarballs from pypi and use
get-pip.py on from here on.

Closes-Bug: #1326539

Change-Id: I0661f7c6913ba6b3e1d00b30e22740d150bfd060
2014-06-04 22:53:25 +00:00

64 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
# **install_pip.sh**
# install_pip.sh [--pip-version <version>] [--use-get-pip] [--force]
#
# Update pip and friends to a known common version
# Assumptions:
# - update pip to $INSTALL_PIP_VERSION
set -o errexit
set -o xtrace
# Keep track of the current directory
TOOLS_DIR=$(cd $(dirname "$0") && pwd)
TOP_DIR=`cd $TOOLS_DIR/..; pwd`
# Change dir to top of devstack
cd $TOP_DIR
# Import common functions
source $TOP_DIR/functions
FILES=$TOP_DIR/files
PIP_GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py
GetDistro
echo "Distro: $DISTRO"
function get_versions {
PIP=$(which pip 2>/dev/null || which pip-python 2>/dev/null || true)
if [[ -n $PIP ]]; then
PIP_VERSION=$($PIP --version | awk '{ print $2}')
echo "pip: $PIP_VERSION"
else
echo "pip: Not Installed"
fi
}
function install_get_pip {
if [[ ! -r $FILES/get-pip.py ]]; then
(cd $FILES; \
curl -O $PIP_GET_PIP_URL; \
)
fi
sudo -E python $FILES/get-pip.py
}
# Show starting versions
get_versions
# Do pip
# Eradicate any and all system packages
uninstall_package python-pip
install_get_pip
get_versions