Permalink
Browse files

Merge pull request #724 from qwcode/unnamed

upper case url reqs not aliased with name.lower() like other forms
  • Loading branch information...
pnasrat committed Nov 15, 2012
2 parents 843ffb3 + d882827 commit 854574f65c4ef92da8dd78b9831a9604dcc9957a
View
@@ -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):
@@ -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):
@@ -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:
@@ -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
+
Binary file not shown.
Binary file not shown.
Binary file not shown.
View
@@ -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)
+
+
+

0 comments on commit 854574f

Please sign in to comment.