Retry pypi name checking

We added logic to change underscores to dashes when checking package
names on pypi. Apparently there is a mix of conventions used here as
this caused some checks to fail.

This changes the check to try the expected sdist name first, and if
that fails, try again with the modified name.

Change-Id: I8c0f2cd6866f295a622c3ccce9620bf4358327af
This commit is contained in:
Sean McGinnis 2018-02-20 08:51:39 -06:00 committed by Doug Hellmann
parent e9bc54694e
commit 80a0c30a36
1 changed files with 7 additions and 4 deletions

View File

@ -557,12 +557,15 @@ def validate_pypi_permissions(deliverable_info, zuul_projects, workdir,
)
continue
# Names like "openstack_requirements" are translated to
# "openstack-requirements" in the PyPI API.
sdist = sdist.replace('_', '-')
print('sdist name {!r}'.format(sdist))
uploaders = pythonutils.get_pypi_uploaders(sdist)
if not uploaders:
# Names like "openstack_requirements" are translated to
# "openstack-requirements" in the PyPI API.
sdist = sdist.replace('_', '-')
print('retrying with sdist name {!r}'.format(sdist))
uploaders = pythonutils.get_pypi_uploaders(sdist)
if not uploaders:
mk_error(
'could not find users with permission to upload packages '