[Checkins] SVN: zc.buildout/trunk/ Removed untested broken code with an optimization to avoid checking

Jim Fulton jim at zope.com
Thu Jul 5 08:24:44 EDT 2007


Log message for revision 77454:
  Removed untested broken code with an optimization to avoid checking
  for versions if the given requirement had an upper limit and we
  already had the distribution whos version was the upper limit.
  
  Added simpler tested code that checks for the simpler case that teh
  requirement is for a specific version and we already have that
  version.  In general, specifying upper limits other than a single
  version is kind of dumb, so it's not worth optimizing for that case.
  

Changed:
  U   zc.buildout/trunk/CHANGES.txt
  U   zc.buildout/trunk/setup.py
  U   zc.buildout/trunk/src/zc/buildout/easy_install.py
  U   zc.buildout/trunk/src/zc/buildout/repeatable.txt
  U   zc.buildout/trunk/src/zc/buildout/tests.py

-=-
Modified: zc.buildout/trunk/CHANGES.txt
===================================================================
--- zc.buildout/trunk/CHANGES.txt	2007-07-05 11:39:13 UTC (rev 77453)
+++ zc.buildout/trunk/CHANGES.txt	2007-07-05 12:24:43 UTC (rev 77454)
@@ -16,6 +16,15 @@
 Change History
 **************
 
+1.0.0b28 (2007-07-05)
+=====================
+
+Bugs Fixed
+----------
+
+- When requiring a specific version, buildout looked for new versions
+  even if that single version was already installed.
+
 1.0.0b27 (2007-06-20)
 =====================
 

Modified: zc.buildout/trunk/setup.py
===================================================================
--- zc.buildout/trunk/setup.py	2007-07-05 11:39:13 UTC (rev 77453)
+++ zc.buildout/trunk/setup.py	2007-07-05 12:24:43 UTC (rev 77454)
@@ -35,7 +35,7 @@
 name = "zc.buildout"
 setup(
     name = name,
-    version = "1.0.0b27",
+    version = "1.0.0b28",
     author = "Jim Fulton",
     author_email = "jim at zope.com",
     description = "System for managing development buildouts",

Modified: zc.buildout/trunk/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/easy_install.py	2007-07-05 11:39:13 UTC (rev 77453)
+++ zc.buildout/trunk/src/zc/buildout/easy_install.py	2007-07-05 12:24:43 UTC (rev 77454)
@@ -180,46 +180,19 @@
             # Environment.__getitem__.
             return dists[0], None
 
-        # Find an upper limit in the specs, if there is one:
-        specs = [(pkg_resources.parse_version(v), op) for (op, v) in req.specs]
-        specs.sort()
-        maxv = None
-        greater = False
-        lastv = None
-        for v, op in specs:
-            if op == '==' and not greater:
-                maxv = v
-            elif op in ('>', '>=', '!='):
-                maxv = None
-                greater == True
-            elif op == '<':
-                maxv = None
-                greater == False
-            elif op == '<=':
-                maxv = v
-                greater == False
+        # Special common case, we have a specification for a single version:
+        specs = req.specs
+        if len(specs) == 1 and specs[0][0] == '==':
+            logger.debug('We have the distribution that satisfies %r.',
+                         str(req))
+            return dists[0], None
 
-            if v == lastv:
-                # Repeated versions values are undefined, so
-                # all bets are off
-                maxv = None
-                greater = True
-            else:
-                lastv = v
-
         best_we_have = dists[0] # Because dists are sorted from best to worst
 
-        # Check if we have the upper limit
-        if maxv is not None and best_we_have.version == maxv:
-            logger.debug('We have the best distribution that satisfies %r.',
-                         str(req))
-            return best_we_have, None
-
         # We have some installed distros.  There might, theoretically, be
         # newer ones.  Let's find out which ones are available and see if
         # any are newer.  We only do this if we're willing to install
         # something, which is only true if dest is not None:
-
         
         if self._dest is not None:
             best_available = self._obtain(req, source)

Modified: zc.buildout/trunk/src/zc/buildout/repeatable.txt
===================================================================
--- zc.buildout/trunk/src/zc/buildout/repeatable.txt	2007-07-05 11:39:13 UTC (rev 77453)
+++ zc.buildout/trunk/src/zc/buildout/repeatable.txt	2007-07-05 12:24:43 UTC (rev 77454)
@@ -151,7 +151,7 @@
     We have the best distribution that satisfies 'setuptools'.
     Picked: setuptools = 0.6
     Installing 'spam'.
-    We have the best distribution that satisfies 'spam==1'.
+    We have the distribution that satisfies 'spam==1'.
     Uninstalling foo.
     Installing foo.
     recipe v1

Modified: zc.buildout/trunk/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/tests.py	2007-07-05 11:39:13 UTC (rev 77453)
+++ zc.buildout/trunk/src/zc/buildout/tests.py	2007-07-05 12:24:43 UTC (rev 77454)
@@ -325,7 +325,7 @@
     We have a develop egg: samplez 1
     Getting required 'demoneeded==1.1'
       required by samplez 1.
-    We have the best distribution that satisfies 'demoneeded==1.1'.
+    We have the distribution that satisfies 'demoneeded==1.1'.
     Getting required 'sampleb'
       required by samplea 1.
     We have a develop egg: sampleb 1



More information about the Checkins mailing list