Skip to content

Commit

Permalink
Made the approach more general, also added support for BitBucket.
Browse files Browse the repository at this point in the history
  • Loading branch information
allenh1 committed Jun 2, 2017
1 parent abdf862 commit 845542c
Showing 1 changed file with 9 additions and 18 deletions.
27 changes: 9 additions & 18 deletions src/rosdistro/rosdistro.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,30 +224,21 @@ def _fetch_package_xml(self, rosdistro):
self._release_tags[rosdistro] = release_tag
return package_xml, release_tag
else:
release_tag = 'release/{0}/{1}/{2}'.format(rosdistro, self.name, repo.version)
for nongithub in supported_non_githubs:
url = repo.url
try:
if nongithub == 'gitlab':
"""
GitLab
"""
info('Trying to fetch non-github repository as a GitLab instance...')
url = repo.url
release_tag = 'release/{0}/{1}/{2}'.format(rosdistro, self.name, repo.version)
url = url.replace('.git', '/raw/{0}/package.xml'.format(release_tag))
elif nongithub == 'bitbucket':
"""
BitBucket
"""
raise RuntimeError('todo: bitbucket support')
url = url.replace('.git', {
'gitlab' : '/raw/{0}/package.xml',
'bitbucket' : '/raw/{0}/package.xml'
}[nongithub].format(release_tag))
package_xml = urlopen(url).read()
self._package_xmls[rosdistro] = package_xml
self._release_tags[rosdistro] = release_tag
return package_xml, release_tag
except Exception as e:
info('Package is not in a {0} repo...'.format({
'gitlab' : 'GitLab',
'bitbucket' : 'BitBucket'
}[nongithub]))
except Exception as e:
# If we get here, try the next one.
pass
raise Exception('Failed to identify non-github repository type!')

def get_package_xml(self, rosdistro):
Expand Down

0 comments on commit 845542c

Please sign in to comment.