Commits

Paulo Köch committed 9943658

Add support for Mercurial URLs.

  • Participants
  • Parent commits ef1eff5

Comments (0)

Files changed (1)

setuptools/package_index.py

             return self._download_svn(url, filename)
         elif scheme=='git' or scheme.startswith('git+'):
             return self._download_git(url, filename)
+        elif scheme.startswith('hg+'):
+            return self._download_hg(url, filename)
         elif scheme=='file':
             return urllib.url2pathname(urlparse.urlparse(url)[2])
         else:
         os.system("git clone -q %s %s" % (url, filename))
         return filename
 
+    def _download_hg(self, url, filename):
+        if url.startswith('hg+'):
+            url = url[3:]
+        url = url.split('#',1)[0]   # remove any fragment for svn's sake
+        filename = filename.split('#',1)[0]   # remove any fragment to get a decent name.
+        self.info("Doing hg clone from %s to %s", url, filename)
+        os.system("hg clone --quiet %s %s" % (url, filename))
+        return filename
+
     def debug(self, msg, *args):
         log.debug(msg, *args)