| ... | ... |
@@ -656,7 +656,7 @@ source $TOP_DIR/tools/install_prereqs.sh |
| 656 | 656 |
|
| 657 | 657 |
# Configure an appropriate python environment |
| 658 | 658 |
if [[ "$OFFLINE" != "True" ]]; then |
| 659 |
- $TOP_DIR/tools/install_pip.sh |
|
| 659 |
+ PYPI_ALTERNATIVE_URL=$PYPI_ALTERNATIVE_URL $TOP_DIR/tools/install_pip.sh |
|
| 660 | 660 |
fi |
| 661 | 661 |
|
| 662 | 662 |
# Do the ugly hacks for broken packages and distros |
| ... | ... |
@@ -50,6 +50,25 @@ function install_get_pip {
|
| 50 | 50 |
} |
| 51 | 51 |
|
| 52 | 52 |
|
| 53 |
+function configure_pypi_alternative_url {
|
|
| 54 |
+ PIP_ROOT_FOLDER="$HOME/.pip" |
|
| 55 |
+ PIP_CONFIG_FILE="$PIP_ROOT_FOLDER/pip.conf" |
|
| 56 |
+ if [[ ! -d $PIP_ROOT_FOLDER ]]; then |
|
| 57 |
+ echo "Creating $PIP_ROOT_FOLDER" |
|
| 58 |
+ mkdir $PIP_ROOT_FOLDER |
|
| 59 |
+ fi |
|
| 60 |
+ if [[ ! -f $PIP_CONFIG_FILE ]]; then |
|
| 61 |
+ echo "Creating $PIP_CONFIG_FILE" |
|
| 62 |
+ touch $PIP_CONFIG_FILE |
|
| 63 |
+ fi |
|
| 64 |
+ if ! ini_has_option "$PIP_CONFIG_FILE" "global" "index-url"; then |
|
| 65 |
+ #it means that the index-url does not exist |
|
| 66 |
+ iniset "$PIP_CONFIG_FILE" "global" "index-url" "$PYPI_OVERRIDE" |
|
| 67 |
+ fi |
|
| 68 |
+ |
|
| 69 |
+} |
|
| 70 |
+ |
|
| 71 |
+ |
|
| 53 | 72 |
# Show starting versions |
| 54 | 73 |
get_versions |
| 55 | 74 |
|
| ... | ... |
@@ -60,6 +79,10 @@ uninstall_package python-pip |
| 60 | 60 |
|
| 61 | 61 |
install_get_pip |
| 62 | 62 |
|
| 63 |
+if [[ -n $PYPI_ALTERNATIVE_URL ]]; then |
|
| 64 |
+ configure_pypi_alternative_url |
|
| 65 |
+fi |
|
| 66 |
+ |
|
| 63 | 67 |
pip_install -U setuptools |
| 64 | 68 |
|
| 65 | 69 |
get_versions |