Skip to content

upper case url reqs not aliased with name.lower() like other forms #724

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 15, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions pip/req.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ def from_line(cls, name, comes_from=None):
# Otherwise, assume the name is the req for the non URL/path/archive case.
if link and req is None:
url = link.url_without_fragment
req = link.egg_fragment
req = link.egg_fragment #when fragment is None, this will become an 'unnamed' requirement

# Handle relative file URLs
if link.scheme == 'file' and re.search(r'\.\./', url):
Expand Down Expand Up @@ -843,6 +843,7 @@ def add_requirement(self, install_req):
install_req.as_egg = self.as_egg
install_req.use_user_site = self.use_user_site
if not name:
#url or path requirement w/o an egg fragment
self.unnamed_requirements.append(install_req)
else:
if self.has_requirement(name):
Expand Down Expand Up @@ -1094,8 +1095,9 @@ def prepare_files(self, finder, force_root_egg_info=False, bundle=False):
subreq = InstallRequirement(req, req_to_install)
reqs.append(subreq)
self.add_requirement(subreq)
if req_to_install.name not in self.requirements:
self.requirements[req_to_install.name] = req_to_install
if not self.has_requirement(req_to_install.name):
#'unnamed' requirements will get added here
self.add_requirement(req_to_install)
if self.is_download or req_to_install._temp_build_dir is not None:
self.reqs_to_cleanup.append(req_to_install)
else:
Expand Down
5 changes: 5 additions & 0 deletions tests/packages/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ simple-[123].0.tar.gz
---------------------
contains "simple" package; good for basic testing and version logic.

Upper-[12].0.tar.gz and requiresuppper-1.0.tar.gz
--------------------------------------------------
'requiresupper' requires 'upper'
used for testing case mismatch case for url requirements




Expand Down
Binary file added tests/packages/Upper-1.0.tar.gz
Binary file not shown.
Binary file added tests/packages/Upper-2.0.tar.gz
Binary file not shown.
Binary file added tests/packages/requiresupper-1.0.tar.gz
Binary file not shown.
23 changes: 23 additions & 0 deletions tests/test_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,3 +184,26 @@ def test_install_local_editable_with_extras():
assert env.site_packages/'easy-install.pth' in res.files_updated
assert env.site_packages/'LocalExtras.egg-link' in res.files_created
assert env.site_packages/'simple' in res.files_created


def test_url_req_case_mismatch():
"""
tar ball url requirements (with no egg fragment), that happen to have upper case project names,
should be considered equal to later requirements that reference the project name using lower case.

tests/packages contains Upper-1.0.tar.gz and Upper-2.0.tar.gz
'requiresupper' has install_requires = ['upper']
"""
env = reset_env()
find_links = 'file://' + os.path.join(here, 'packages')
Upper = os.path.join(find_links, 'Upper-1.0.tar.gz')
result = run_pip('install', '--no-index', '-f', find_links, Upper, 'requiresupper')

#only Upper-1.0.tar.gz should get installed.
egg_folder = env.site_packages / 'Upper-1.0-py%s.egg-info' % pyversion
assert egg_folder in result.files_created, str(result)
egg_folder = env.site_packages / 'Upper-2.0-py%s.egg-info' % pyversion
assert egg_folder not in result.files_created, str(result)