make it easier to map deliverable type to release type

Change-Id: I0cb1a87efeca1fb44878501ac1cbd6f72da7f688
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2017-10-26 15:59:21 -04:00
parent 1016065aa6
commit e11e4e89d2

View File

@ -348,6 +348,13 @@ def validate_gitreview(deliverable_info, workdir, mk_warning, mk_error):
mk_error('%s has no .gitreview file' % (project['repo'],))
_TYPE_TO_RELEASE_TYPE = {
'library': 'python-pypi',
'service': 'python-service',
'horizon-plugin': 'horizon',
}
def get_release_type(deliverable_info, project, workdir):
"""Return tuple with release type and boolean indicating whether it
was explicitly set.
@ -356,11 +363,9 @@ def get_release_type(deliverable_info, project, workdir):
if 'release-type' in deliverable_info:
return (deliverable_info['release-type'], True)
if deliverable_info.get('type') == 'library':
return ('python-pypi', False)
if deliverable_info.get('type') == 'service':
return ('python-service', False)
from_type = _TYPE_TO_RELEASE_TYPE.get(deliverable_info.get('type'))
if from_type is not None:
return (from_type, False)
if deliverable_info.get('include-pypi-link', False):
return ('python-pypi', False)