Allow setting DIB_PIP_RETRIES

Pip now supports retries on failure. If setting multiple pypi mirrors a
fallback will not occure until the failures have finished for the first
mirror. This can cause a substantial delay if mirror fallback occurs a
lot.

Change-Id: Iad37a9015a2d5c861a345a111bd1725b965a42d3
This commit is contained in:
Gregory Haynes 2015-02-19 15:11:52 -08:00
parent 2f4d5be6f3
commit 533896812f
2 changed files with 9 additions and 0 deletions

View File

@ -24,10 +24,16 @@ the first mirror to be used, the last listed mirror is used as the pydistutils
index. NB: The sort order for these variables is a simple string sort - if you
have more than 9 additional mirrors, some care will be needed.
You can also set the number of retries that occur on failure by setting the
DIB\_PIP\_RETRIES environment variable. If setting fallback pip mirrors you
typically want to set this to 0 to prevent the need to fail multiple times
before falling back.
A typical use of this element is thus:
export DIB\_PYPI\_MIRROR\_URL=http://site/pypi/Ubuntu-13.10
export DIB\_PYPI\_MIRROR\_URL\_1=http://site/pypi/
export DIB\_PYPI\_MIRROR\_URL\_2=file:///tmp/pypi
export DIB\_PIP\_RETRIES=0
[devpi-server](https://git.openstack.org/cgit/openstack-infra/pypi-mirro://pypi.python.org/pypi/devpi-server)
can be useful in making a partial PyPI mirror suitable for building images. For

View File

@ -44,10 +44,13 @@ def main():
use_pypi_python_org = False
if use_pypi_python_org:
indices.append('https://pypi.python.org/simple')
retries = os.environ.get('DIB_PIP_RETRIES')
with file(home + '/.pip/pip.conf', 'wt') as output:
output.write('[global]\n')
output.write('log = %s/pip.log\n' % (home,))
output.write('index-url = %s\n' % (indices[0],))
if retries is not None:
output.write('retries = %s\n' % retries)
for index in indices[1:]:
output.write('extra-index-url = %s\n' % (index,))
with file(home + '/.pydistutils.cfg', 'wt') as output: