3b782d304e
Latest release of setuptool 8.0 made several versions used in requirements.txt of OpenStack projects invalid. Instances: * SQLAlchemy>=0.8.4,<=0.8.99,>=0.9.7,<=0.9.99 in oslo.db 1.2.0 * python-neutronclient 2.3.9.40.g9ed73c0 in openstackclient Cap '<8.0' is set as a temporary fix until a better solution comes up. Change-Id: I4cfe2e4c86474ec9bf69a3c2007c0277288ea2b6
89 lines
1.9 KiB
Bash
Executable File
89 lines
1.9 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
|
|
LOCAL_PIP="$FILES/$(basename $PIP_GET_PIP_URL)"
|
|
|
|
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 $LOCAL_PIP ]]; then
|
|
curl -o $LOCAL_PIP $PIP_GET_PIP_URL || \
|
|
die $LINENO "Download of get-pip.py failed"
|
|
fi
|
|
sudo -E python $LOCAL_PIP
|
|
}
|
|
|
|
|
|
function configure_pypi_alternative_url {
|
|
PIP_ROOT_FOLDER="$HOME/.pip"
|
|
PIP_CONFIG_FILE="$PIP_ROOT_FOLDER/pip.conf"
|
|
if [[ ! -d $PIP_ROOT_FOLDER ]]; then
|
|
echo "Creating $PIP_ROOT_FOLDER"
|
|
mkdir $PIP_ROOT_FOLDER
|
|
fi
|
|
if [[ ! -f $PIP_CONFIG_FILE ]]; then
|
|
echo "Creating $PIP_CONFIG_FILE"
|
|
touch $PIP_CONFIG_FILE
|
|
fi
|
|
if ! ini_has_option "$PIP_CONFIG_FILE" "global" "index-url"; then
|
|
#it means that the index-url does not exist
|
|
iniset "$PIP_CONFIG_FILE" "global" "index-url" "$PYPI_OVERRIDE"
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
# Show starting versions
|
|
get_versions
|
|
|
|
# Do pip
|
|
|
|
# Eradicate any and all system packages
|
|
uninstall_package python-pip
|
|
|
|
install_get_pip
|
|
|
|
if [[ -n $PYPI_ALTERNATIVE_URL ]]; then
|
|
configure_pypi_alternative_url
|
|
fi
|
|
|
|
pip_install -U "setuptools<8.0"
|
|
|
|
get_versions
|