Skip to content

Commit

Permalink
Changed order of the url check. (ros-infrastructure#100)
Browse files Browse the repository at this point in the history
* Changed order of the url check.

* update

* revert whitespace change
  • Loading branch information
Hunter Allen authored and dirk-thomas committed Jun 1, 2017
1 parent d5f6f03 commit c4f076d
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/rosdistro/rosdistro.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.')
Expand All @@ -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'
Expand Down

0 comments on commit c4f076d

Please sign in to comment.