ENH: use proper uri instead of hacked-up string manipulation for repos.

This allows us to fix quite a few windows test failures/errors.

I am not sure whether those changes make sense. The manual string manipulation make me cringe, but it is easy to break some untested corner cases. I will let someone more experienced with enstaller judge on whether we should merge that in or not.