97bc5d7853
Using a custom pypi mirror can be very convenient, making image builds substantially faster - because we create multiple virtual environments we benefit more than single-virtualenv users would. Change-Id: I997daf1f9477c447e1fb30818aea9e80a49b31a6
32 lines
480 B
Bash
Executable file
32 lines
480 B
Bash
Executable file
#!/bin/bash
|
|
|
|
set -eu
|
|
|
|
PYPIURL=file:///tmp/pypi
|
|
mkdir -p ~/.pip
|
|
|
|
if [ -e ~/.pip/pip.conf ]; then
|
|
mv ~/.pip/pip.conf{,.orig}
|
|
fi
|
|
|
|
if [ -e ~/.pydistutils.cfg ]; then
|
|
mv ~/.pydistutils.cfg{,.orig}
|
|
fi
|
|
|
|
if [ -z $DIB_OFFLINE ]; then
|
|
ONLINE="extra-index-url = https://pypi.python.org/simple"
|
|
else
|
|
ONLINE=""
|
|
fi
|
|
|
|
cat <<EOF > ~/.pip/pip.conf
|
|
[global]
|
|
index-url = $PYPIURL
|
|
$ONLINE
|
|
log = $HOME/pip.log
|
|
EOF
|
|
|
|
cat <<EOF > ~/.pydistutils.cfg
|
|
[easy_install]
|
|
index_url = $PYPIURL
|
|
EOF
|