From 755e5d3c5e5525e23ace5a593c0df7f4e9540376 Mon Sep 17 00:00:00 2001 From: "Hunter L. Allen" Date: Fri, 2 Jun 2017 14:21:11 -0700 Subject: [PATCH] Added better support for non-github release repositories. Fixes: - ros-infrastructure/rosdistro#101 - ros/ros-overlay#30 --- src/rosdistro/rosdistro.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/rosdistro/rosdistro.py b/src/rosdistro/rosdistro.py index 4033ac25b..baae642f0 100644 --- a/src/rosdistro/rosdistro.py +++ b/src/rosdistro/rosdistro.py @@ -222,7 +222,18 @@ 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) + url = repo.url + try: + # URL extension for GitLab/BitBucket repos + url = url.replace('.git', '/raw/{0}/package.xml'.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: + msg = "Failed to read package.xml file from url '{0}': {1}".format(url, e)) + raise RuntimeError(msg) def get_package_xml(self, rosdistro): if rosdistro not in self._package_xmls: