From c4f076d30368097b73d27918dea7bc218850a806 Mon Sep 17 00:00:00 2001 From: Hunter Allen Date: Thu, 1 Jun 2017 11:46:23 -0700 Subject: [PATCH] Changed order of the url check. (#100) * Changed order of the url check. * update * revert whitespace change --- src/rosdistro/rosdistro.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/rosdistro/rosdistro.py b/src/rosdistro/rosdistro.py index 0f2b01471..4033ac25b 100644 --- a/src/rosdistro/rosdistro.py +++ b/src/rosdistro/rosdistro.py @@ -199,8 +199,7 @@ def _fetch_package_xml(self, rosdistro): repo = self.repository if 'github.com' in repo.url: url = repo.url - upstream_version = repo.version.split('-')[0] - release_tag = 'release/{0}/{1}'.format(self.name, upstream_version) + release_tag = 'release/{0}/{1}/{2}'.format(rosdistro, self.name, repo.version) url = url.replace('.git', '/{0}/package.xml'.format(release_tag)) url = url.replace('git://', 'https://') url = url.replace('https://', 'https://raw.') @@ -210,13 +209,10 @@ def _fetch_package_xml(self, rosdistro): except Exception as e: msg = "Failed to read package.xml file from url '{0}': {1}".format(url, e) warning(msg) - url = repo.url - release_tag = 'release/{0}/{1}/{2}'.format(rosdistro, self.name, repo.version) - tail = '/{0}/package.xml'.format(release_tag) - url = url.replace('.git', tail) - url = url.replace('git://', 'https://') - url = url.replace('https://', 'https://raw.') - info("Trying to read from url '{0}' instead".format(url)) + upstream_version = repo.version.split('-')[0] + legacy_release_tag = 'release/{0}/{1}'.format(self.name, upstream_version) + url = url.replace(release_tag, legacy_release_tag) + info("Trying to read from legacy-style url '{0}' instead".format(url)) package_xml = urlopen(url).read() except Exception as e: msg += '\nAND\n'