[Checkins] SVN: zc.buildout/trunk/ fix bug 623590: do not prefer site-packages over newer distributions

Gary Poster gary.poster at canonical.com
Sun Aug 29 12:23:41 EDT 2010


Log message for revision 115995:
  fix bug 623590: do not prefer site-packages over newer distributions

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

-=-
Modified: zc.buildout/trunk/CHANGES.txt
===================================================================
--- zc.buildout/trunk/CHANGES.txt	2010-08-28 16:25:28 UTC (rev 115994)
+++ zc.buildout/trunk/CHANGES.txt	2010-08-29 16:23:40 UTC (rev 115995)
@@ -4,8 +4,12 @@
 1.5.1 (unreleased)
 ==================
 
-(no changes so far)
+Bugs fixed:
 
+- https://bugs.launchpad.net/bugs/623590 : If include-site-packages were
+  true and versions were not set explicitly, system eggs were preferred
+  over newer released eggs.  Fixed.
+
 1.5.0 (2010-08-23)
 ==================
 

Modified: zc.buildout/trunk/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/easy_install.py	2010-08-28 16:25:28 UTC (rev 115994)
+++ zc.buildout/trunk/src/zc/buildout/easy_install.py	2010-08-29 16:23:40 UTC (rev 115995)
@@ -443,7 +443,12 @@
         # env.__getitem__
 
         for dist in dists:
-            if (dist.precedence == pkg_resources.DEVELOP_DIST):
+            if (dist.precedence == pkg_resources.DEVELOP_DIST and
+                dist.location not in self._site_packages):
+                # System eggs are sometimes installed as develop eggs.
+                # Those are not the kind of develop eggs we are looking for
+                # here: we want ones that the buildout itself has locally as
+                # develop eggs.
                 logger.debug('We have a develop egg: %s', dist)
                 return dist, None
 

Modified: zc.buildout/trunk/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/tests.py	2010-08-28 16:25:28 UTC (rev 115994)
+++ zc.buildout/trunk/src/zc/buildout/tests.py	2010-08-29 16:23:40 UTC (rev 115995)
@@ -420,7 +420,7 @@
 indicate the eggs from site-packages that have been selected.  You'll see
 we have two: demo 0.3 and demoneeded 1.1.
 
-    >>> print system(buildout+" -v")
+    >>> print system(buildout+" -v"),
     Installing 'zc.buildout', 'setuptools'.
     We have a develop egg: zc.buildout V
     We have the best distribution that satisfies 'setuptools'.
@@ -435,13 +435,12 @@
     Picked: bigdemo = 0.1
     Getting required 'demo'
       required by bigdemo 0.1.
-    We have a develop egg: demo V
+    We have the best distribution that satisfies 'demo'.
     Egg from site-packages: demo 0.3
     Getting required 'demoneeded'
       required by demo 0.3.
-    We have a develop egg: demoneeded V
+    We have the best distribution that satisfies 'demoneeded'.
     Egg from site-packages: demoneeded 1.1
-    <BLANKLINE>
     """
 
 def test_comparing_saved_options_with_funny_characters():
@@ -2150,6 +2149,35 @@
 
     """
 
+def include_site_packages_bug_623590():
+    """
+As mentioned in isolated_include_site_packages, some system Pythons
+include various Python packages in their site-packages (or equivalent)
+using a .egg-info directory.  The pkg_resources module (from setuptools)
+considers a package installed using .egg-info to be a develop egg
+
+We generally prefer develop eggs when we are selecting dependencies, because
+we expect them to be eggs that buildout has been told to develop.  However,
+we should not consider these site-packages eggs as develop eggs--they should
+not have automatic precedence over eggs available elsewhere.
+
+We have specific code to handle this case, as identified in bug 623590.
+See zc.buildout.easy_install.Installer._satisfied, as of this writing,
+for the pertinent code. Here's the test for the bugfix.
+
+    >>> py_path, site_packages_path = make_py()
+    >>> create_sample_sys_install(site_packages_path)
+    >>> zc.buildout.easy_install.include_site_packages(False)
+    True
+
+    >>> example_dest = tmpdir('site-packages-example-install')
+    >>> workingset = zc.buildout.easy_install.install(
+    ...     ['demo'], example_dest, links=[sample_eggs], executable=py_path,
+    ...     index=None, include_site_packages=True, prefer_final=False)
+    >>> [(dist.project_name, dist.version) for dist in workingset]
+    [('demo', '0.4c1'), ('demoneeded', '1.2c1')]
+"""
+
 def allowed_eggs_from_site_packages():
     """
 Sometimes you need or want to control what eggs from site-packages are used.



More information about the checkins mailing list