more robustly handle error when we can't determine sdist name

Instead of passing None to the service as the sdist name, report that
situation as an error.

Change-Id: Ib6380d997db780ae324a4df61fdfa7f17e4507c3
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-03-27 14:51:03 -04:00
parent 908deccc5b
commit 4ad924d16f
2 changed files with 11 additions and 3 deletions

View File

@ -570,11 +570,17 @@ def validate_pypi_permissions(deliv, context):
'for {} to check PyPI permissions: {}'.format(
repo.name, err)
)
continue
return
LOG.debug('using sdist name as pypi-name {!r}'.format(sdist))
pypi_name = sdist
if not pypi_name:
context.error(
'Could not determine a valid PyPI dist name for {}'.format(
deliv.name))
return
uploaders = pythonutils.get_pypi_uploaders(pypi_name)
if not uploaders:
context.error(

View File

@ -29,8 +29,10 @@ LOG = logging.getLogger(__name__)
def get_sdist_name(workdir, repo):
"Check out the code."
dest = os.path.join(workdir, repo)
if not os.path.exists(os.path.join(dest, 'setup.py')):
# Not a python project
setup_path = os.path.join(dest, 'setup.py')
if not os.path.exists(setup_path):
LOG.debug('did not find %s, maybe %s is not a python project',
setup_path, repo)
return None
use_tox = repo.endswith('/pbr')
if use_tox and not os.path.exists(os.path.join(dest, '.tox', 'venv')):