Merge "Allow setting DIB_PIP_RETRIES"

This commit is contained in:
Jenkins 2015-04-23 03:51:57 +00:00 committed by Gerrit Code Review
commit 1f38bfad41
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: