[Python-checkins] commit of r41380 - in sandbox/trunk/setuptools: . setuptools/tests

phillip.eby@python.org phillip.eby at python.org
Thu Nov 3 03:24:50 CET 2005


Author: phillip.eby
Date: Thu Nov  3 03:24:49 2005
New Revision: 41380

Modified:
   sandbox/trunk/setuptools/pkg_resources.py
   sandbox/trunk/setuptools/pkg_resources.txt
   sandbox/trunk/setuptools/setuptools/tests/test_resources.py
Log:
Fixed a problem with ``WorkingSet.resolve()`` that prevented version
conflicts from being detected at runtime.  (As reported by Ian Bicking.)


Modified: sandbox/trunk/setuptools/pkg_resources.py
==============================================================================
--- sandbox/trunk/setuptools/pkg_resources.py	(original)
+++ sandbox/trunk/setuptools/pkg_resources.py	Thu Nov  3 03:24:49 2005
@@ -482,7 +482,7 @@
                     if dist is None:
                         raise DistributionNotFound(req)  # XXX put more info here
                 to_activate.append(dist)
-            elif dist not in req:
+            if dist not in req:
                 # Oops, the "best" so far conflicts with a dependency
                 raise VersionConflict(dist,req) # XXX put more info here
             requirements.extend(dist.requires(req.extras)[::-1])

Modified: sandbox/trunk/setuptools/pkg_resources.txt
==============================================================================
--- sandbox/trunk/setuptools/pkg_resources.txt	(original)
+++ sandbox/trunk/setuptools/pkg_resources.txt	Thu Nov  3 03:24:49 2005
@@ -1488,6 +1488,10 @@
 Release Notes/Change History
 ----------------------------
 
+0.6a8
+ * Fixed a problem with ``WorkingSet.resolve()`` that prevented version
+   conflicts from being detected at runtime.
+
 0.6a6
  * Activated distributions are now inserted in ``sys.path`` (and the working
    set) just before the directory that contains them, instead of at the end.

Modified: sandbox/trunk/setuptools/setuptools/tests/test_resources.py
==============================================================================
--- sandbox/trunk/setuptools/setuptools/tests/test_resources.py	(original)
+++ sandbox/trunk/setuptools/setuptools/tests/test_resources.py	Thu Nov  3 03:24:49 2005
@@ -125,7 +125,6 @@
         ad = Environment([]); ws = WorkingSet([])
         # Resolving no requirements -> nothing to install
         self.assertEqual( list(ws.resolve([],ad)), [] )
-
         # Request something not in the collection -> DistributionNotFound
         self.assertRaises(
             DistributionNotFound, ws.resolve, parse_requirements("Foo"), ad
@@ -141,6 +140,8 @@
             targets = list(ws.resolve(parse_requirements("Foo"), ad))
             self.assertEqual(targets, [Foo])
             map(ws.add,targets)
+        self.assertRaises(VersionConflict, ws.resolve,
+            parse_requirements("Foo==0.9"), ad)
         ws = WorkingSet([]) # reset
         
         # Request an extra that causes an unresolved dependency for "Baz"
@@ -157,11 +158,10 @@
             list(ws.resolve(parse_requirements("Foo[bar]"), ad)), [Foo,Baz]
         )
         # Requests for conflicting versions produce VersionConflict
-        self.assertRaises(
-            VersionConflict,
+        self.assertRaises( VersionConflict,
             ws.resolve, parse_requirements("Foo==1.2\nFoo!=1.2"), ad
         )
-
+        
     def testDistroDependsOptions(self):
         d = self.distRequires("""
             Twisted>=1.5


More information about the Python-checkins mailing list