Fix the pypi element for multiple mirror URLs

The 'pypi' mirror element is generating invalid pip.conf files
when more than one "DIB_PYPI_MIRROR_URL" is specified.
This patch fixes the pip.conf file rendering to use a proper form
when there are multiple "extra_index_url" provided.

Closes-Bug: #1839558
Change-Id: Ibda0e7390955683560e09b486f636775643ff57c
This commit is contained in:
Michael Johnson 2019-08-08 14:14:11 -07:00
parent 37909a0e81
commit bac0fa3eb2

View File

@ -57,8 +57,10 @@ def main():
output.write('trusted-host = %s\n' % (urlparse(indices[0]).hostname,))
if retries is not None:
output.write('retries = %s\n' % retries)
for index in indices[1:]:
output.write('extra-index-url = %s\n' % (index,))
if len(indices) > 1:
output.write('extra-index-url =\n')
for index in indices[1:]:
output.write(' %s\n' % (index,))
with open(home + '/.pydistutils.cfg', 'wt') as output:
output.write('[easy_install]\n')
output.write('index_url = %s\n' % (easy_index,))