Merge "Support of an alternate pypi server"

This commit is contained in:
Jenkins 2014-07-31 06:09:10 +00:00 committed by Gerrit Code Review
commit 54650ce137
2 changed files with 24 additions and 1 deletions

View File

@ -656,7 +656,7 @@ source $TOP_DIR/tools/install_prereqs.sh
# Configure an appropriate python environment # Configure an appropriate python environment
if [[ "$OFFLINE" != "True" ]]; then if [[ "$OFFLINE" != "True" ]]; then
$TOP_DIR/tools/install_pip.sh PYPI_ALTERNATIVE_URL=$PYPI_ALTERNATIVE_URL $TOP_DIR/tools/install_pip.sh
fi fi
# Do the ugly hacks for broken packages and distros # Do the ugly hacks for broken packages and distros

View File

@ -50,6 +50,25 @@ function install_get_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 # Show starting versions
get_versions get_versions
@ -60,6 +79,10 @@ uninstall_package python-pip
install_get_pip install_get_pip
if [[ -n $PYPI_ALTERNATIVE_URL ]]; then
configure_pypi_alternative_url
fi
pip_install -U setuptools pip_install -U setuptools
get_versions get_versions