2013-08-01 17:40:40 -05:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# **install_pip.sh**
|
|
|
|
|
2013-08-10 23:49:47 -03:00
|
|
|
# install_pip.sh [--pip-version <version>] [--use-get-pip] [--force]
|
2013-08-01 17:40:40 -05:00
|
|
|
#
|
|
|
|
# Update pip and friends to a known common version
|
|
|
|
|
|
|
|
# Assumptions:
|
|
|
|
# - update pip to $INSTALL_PIP_VERSION
|
|
|
|
|
2013-10-01 00:35:16 +01:00
|
|
|
set -o errexit
|
|
|
|
set -o xtrace
|
|
|
|
|
2013-08-01 17:40:40 -05:00
|
|
|
# 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
|
|
|
|
|
2014-06-04 16:25:52 -04:00
|
|
|
PIP_GET_PIP_URL=https://bootstrap.pypa.io/get-pip.py
|
2013-08-01 17:40:40 -05:00
|
|
|
|
|
|
|
GetDistro
|
|
|
|
echo "Distro: $DISTRO"
|
|
|
|
|
2014-02-21 15:35:08 +11:00
|
|
|
function get_versions {
|
2013-10-07 07:29:27 +02:00
|
|
|
PIP=$(which pip 2>/dev/null || which pip-python 2>/dev/null || true)
|
2013-08-01 17:40:40 -05:00
|
|
|
if [[ -n $PIP ]]; then
|
|
|
|
PIP_VERSION=$($PIP --version | awk '{ print $2}')
|
2013-08-10 23:49:47 -03:00
|
|
|
echo "pip: $PIP_VERSION"
|
2013-10-07 07:29:27 +02:00
|
|
|
else
|
|
|
|
echo "pip: Not Installed"
|
2013-08-01 17:40:40 -05:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2014-02-21 15:35:08 +11:00
|
|
|
function install_get_pip {
|
2013-08-01 17:40:40 -05:00
|
|
|
if [[ ! -r $FILES/get-pip.py ]]; then
|
|
|
|
(cd $FILES; \
|
2013-11-23 13:02:45 -05:00
|
|
|
curl -O $PIP_GET_PIP_URL; \
|
2013-08-01 17:40:40 -05:00
|
|
|
)
|
|
|
|
fi
|
2013-12-05 14:56:14 +01:00
|
|
|
sudo -E python $FILES/get-pip.py
|
2013-08-01 17:40:40 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Show starting versions
|
|
|
|
get_versions
|
|
|
|
|
|
|
|
# Do pip
|
|
|
|
|
2013-08-10 23:49:47 -03:00
|
|
|
# Eradicate any and all system packages
|
|
|
|
uninstall_package python-pip
|
2013-08-01 17:40:40 -05:00
|
|
|
|
2014-06-04 16:25:52 -04:00
|
|
|
install_get_pip
|
2013-08-10 23:49:47 -03:00
|
|
|
|
|
|
|
get_versions
|