| ... | ... |
@@ -46,10 +46,36 @@ function install_get_pip {
|
| 46 | 46 |
curl -o $LOCAL_PIP $PIP_GET_PIP_URL || \ |
| 47 | 47 |
die $LINENO "Download of get-pip.py failed" |
| 48 | 48 |
fi |
| 49 |
- sudo -E python $LOCAL_PIP |
|
| 49 |
+ sudo -H -E python $LOCAL_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 |
+# Setuptools 8 implements PEP 440, and 8.0.4 adds a warning triggered any time |
|
| 72 |
+# pkg_resources inspects the list of installed Python packages if there are |
|
| 73 |
+# non-compliant version numbers in the egg-info (for example, from distro |
|
| 74 |
+# system packaged Python libraries). This is off by default after 8.2 but can |
|
| 75 |
+# be enabled by uncommenting the lines below. |
|
| 76 |
+#PYTHONWARNINGS=$PYTHONWARNINGS,always::RuntimeWarning:pkg_resources |
|
| 77 |
+#export PYTHONWARNINGS |
|
| 78 |
+ |
|
| 53 | 79 |
# Show starting versions |
| 54 | 80 |
get_versions |
| 55 | 81 |
|
| ... | ... |
@@ -60,4 +86,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 |
+ |
|
| 67 |
+pip_install -U setuptools |
|
| 68 |
+ |
|
| 63 | 69 |
get_versions |