Preserve the query portion of URL-type InstallRequirement URLs.

With this patch, install commands like:

  pip install 'http://foo.com/?p=bar.git;a=snapshot;h=v0.3;sf=tgz'

will work as expected.
This commit is contained in:
W. Trevor King 2012-04-05 16:55:26 -04:00
parent dfe39ed160
commit c3d51bd891
2 changed files with 6 additions and 1 deletions

View File

@ -621,6 +621,11 @@ class Link(object):
url = url.rstrip('/')
return url
@property
def url_without_fragment(self):
scheme, netloc, path, query, fragment = urlparse.urlsplit(self.url)
return urlparse.urlunsplit((scheme, netloc, path, query, None))
_egg_fragment_re = re.compile(r'#egg=([^&]*)')
@property

View File

@ -95,7 +95,7 @@ class InstallRequirement(object):
# If the line has an egg= definition, but isn't editable, pull the requirement out.
# Otherwise, assume the name is the req for the non URL/path/archive case.
if link and req is None:
url = link.url_fragment
url = link.url_without_fragment
req = link.egg_fragment
# Handle relative file URLs