Normalize names in a URL

PyPI and Bandersnatch now normalize the project name in their
URLs. This change matches that and will reduce the number of
redirects we hit on PyPI and will reduce the need to hit /simple/
on a Bandersnatch mirror.
This commit is contained in:
Donald Stufft 2014-08-28 19:11:09 -04:00
parent 5defca2e25
commit cc2a44e995
2 changed files with 5 additions and 5 deletions

View File

@ -256,7 +256,7 @@ class InstallRequirement(object):
def url_name(self):
if self.req is None:
return None
return urllib_parse.quote(self.req.unsafe_name)
return urllib_parse.quote(self.req.project_name.lower())
@property
def setup_py(self):

View File

@ -25,7 +25,7 @@ def test_command_line_options_override_env_vars(script, virtualenv):
script.environ['PIP_INDEX_URL'] = 'http://b.pypi.python.org/simple/'
result = script.pip('install', '-vvv', 'INITools', expect_error=True)
assert (
"Getting page http://b.pypi.python.org/simple/INITools"
"Getting page http://b.pypi.python.org/simple/initools"
in result.stdout
)
virtualenv.clear()
@ -141,7 +141,7 @@ def _test_config_file_override_stack(script, virtualenv, config_file):
"""))
result = script.pip('install', '-vvv', 'INITools', expect_error=True)
assert (
"Getting page http://download.zope.org/ppix/INITools" in result.stdout
"Getting page http://download.zope.org/ppix/initools" in result.stdout
)
virtualenv.clear()
(script.scratch_path / config_file).write(textwrap.dedent("""\
@ -151,7 +151,7 @@ def _test_config_file_override_stack(script, virtualenv, config_file):
index-url = https://pypi.gocept.com/
"""))
result = script.pip('install', '-vvv', 'INITools', expect_error=True)
assert "Getting page https://pypi.gocept.com/INITools" in result.stdout
assert "Getting page https://pypi.gocept.com/initools" in result.stdout
result = script.pip(
'install', '-vvv', '--index-url', 'http://pypi.python.org/simple',
'INITools',
@ -163,7 +163,7 @@ def _test_config_file_override_stack(script, virtualenv, config_file):
)
assert "Getting page https://pypi.gocept.com/INITools" not in result.stdout
assert (
"Getting page http://pypi.python.org/simple/INITools" in result.stdout
"Getting page http://pypi.python.org/simple/initools" in result.stdout
)