def test_parse_repo_url_and_revision(self): testcases = [ ('http://github.com/foo/bar', 'http://github.com/foo/bar', ''), ('http://github.com/foo/bar@12345', 'http://github.com/foo/bar', '12345'), ('file:///tmp/', 'file:///tmp/', ''), ] for testcase in testcases: (url, rev) = parse_repo_url_and_revision(testcase[0]) self.assertEqual(testcase[1], url) self.assertEqual(testcase[2], rev)
def __init__(self, install_req): self._install_req = install_req if install_req.link is None: raise 'No URL found in install_req: %s' % str(install_req) self.url, self.revision = parse_repo_url_and_revision(install_req.link.url) self.metadata = None self.vcs = None self.type = 'vcs' if install_req.link.url.find('+') >= 0: self.vcs = install_req.link.url[:install_req.link.url.find('+')] elif self._archive_regex.match(install_req.link.url) is not None: self.type = 'archive' self.setuptools_req = install_req.req # may be None