Skip to content

Commit

Permalink
Added better support for non-github release repositories.
Browse files Browse the repository at this point in the history
  • Loading branch information
allenh1 committed Jun 2, 2017
1 parent c4f076d commit 1785a3b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/rosdistro/rosdistro.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,8 @@ def __init__(self, name, repository):

def _fetch_package_xml(self, rosdistro):
repo = self.repository
supported_non_githubs = [ 'gitlab', 'bitbucket' ]

if 'github.com' in repo.url:
url = repo.url
release_tag = 'release/{0}/{1}/{2}'.format(rosdistro, self.name, repo.version)
Expand All @@ -222,7 +224,22 @@ def _fetch_package_xml(self, rosdistro):
self._release_tags[rosdistro] = release_tag
return package_xml, release_tag
else:
raise Exception("Non-github repositories are net yet supported by the rosdistro tool")
release_tag = 'release/{0}/{1}/{2}'.format(rosdistro, self.name, repo.version)
for nongithub in supported_non_githubs:
url = repo.url
try:
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:
# If we get here, try the next one.
pass
raise Exception('Failed to identify non-github repository type!')

def get_package_xml(self, rosdistro):
if rosdistro not in self._package_xmls:
Expand Down

0 comments on commit 1785a3b

Please sign in to comment.