Commits

tarek  committed 0b79630

fixed the parsed api when dealing with setuptools name

  • Participants
  • Parent commits 467bc9f
  • Branches 0.6-maintenance

Comments (0)

Files changed (2)

File pkg_resources.py

                 # and if distribute is installed, we want to give
                 # distribute instead
                 if founded_req.project_name == 'setuptools':
-                    try:
-                        return self.parse('distribute')
-                    except ValueError:
-                        return founded_req
-                return founded_req
+                    distribute = list(parse_requirements('distribute'))
+                    if len(distribute) == 1:
+                        return distribute[0]
+                    return founded_req
+                else:
+                    return founded_req
 
             raise ValueError("Expected only one requirement", s)
         raise ValueError("No requirements found", s)

File setuptools/tests/test_resources.py

         self.assertRaises(VersionConflict, ws.resolve,
             parse_requirements("Foo==0.9"), ad)
         ws = WorkingSet([]) # reset
-        
+
         # Request an extra that causes an unresolved dependency for "Baz"
         self.assertRaises(
             DistributionNotFound, ws.resolve,parse_requirements("Foo[bar]"), ad
         self.assertRaises( VersionConflict,
             ws.resolve, parse_requirements("Foo==1.2\nFoo!=1.2"), ad
         )
-        
+
     def testDistroDependsOptions(self):
         d = self.distRequires("""
             Twisted>=1.5
         )
 
     def testVersionEquality(self):
-        r1 = Requirement.parse("setuptools==0.3a2")
-        r2 = Requirement.parse("setuptools!=0.3a4")
+        r1 = Requirement.parse("foo==0.3a2")
+        r2 = Requirement.parse("foo!=0.3a4")
         d = Distribution.from_filename
 
-        self.failIf(d("setuptools-0.3a4.egg") in r1)
-        self.failIf(d("setuptools-0.3a1.egg") in r1)
-        self.failIf(d("setuptools-0.3a4.egg") in r2)
+        self.failIf(d("foo-0.3a4.egg") in r1)
+        self.failIf(d("foo-0.3a1.egg") in r1)
+        self.failIf(d("foo-0.3a4.egg") in r2)
 
-        self.failUnless(d("setuptools-0.3a2.egg") in r1)
-        self.failUnless(d("setuptools-0.3a2.egg") in r2)
-        self.failUnless(d("setuptools-0.3a3.egg") in r2)
-        self.failUnless(d("setuptools-0.3a5.egg") in r2)
+        self.failUnless(d("foo-0.3a2.egg") in r1)
+        self.failUnless(d("foo-0.3a2.egg") in r2)
+        self.failUnless(d("foo-0.3a3.egg") in r2)
+        self.failUnless(d("foo-0.3a5.egg") in r2)