Skip to content

Commit

Permalink
Normalize names in a URL
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dstufft committed Sep 18, 2014
1 parent 5defca2 commit cc2a44e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pip/req/req_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ def name(self):
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):
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/test_install_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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("""\
Expand All @@ -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',
Expand All @@ -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
)


Expand Down

0 comments on commit cc2a44e

Please sign in to comment.