[Checkins] SVN: zc.buildout/branches/gary-5-show-site-packages-eggs/ the new -v behavior, that shows the eggs that came from site-packages, if any

Gary Poster gary.poster at canonical.com
Fri Sep 25 18:07:25 EDT 2009


Log message for revision 104554:
  the new -v behavior, that shows the eggs that came from site-packages, if any

Changed:
  U   zc.buildout/branches/gary-5-show-site-packages-eggs/CHANGES.txt
  U   zc.buildout/branches/gary-5-show-site-packages-eggs/src/zc/buildout/easy_install.py
  U   zc.buildout/branches/gary-5-show-site-packages-eggs/src/zc/buildout/tests.py

-=-
Modified: zc.buildout/branches/gary-5-show-site-packages-eggs/CHANGES.txt
===================================================================
--- zc.buildout/branches/gary-5-show-site-packages-eggs/CHANGES.txt	2009-09-25 22:06:38 UTC (rev 104553)
+++ zc.buildout/branches/gary-5-show-site-packages-eggs/CHANGES.txt	2009-09-25 22:07:25 UTC (rev 104554)
@@ -27,6 +27,10 @@
     the end of the dependency paths in sys.path (but, as before, these
     are still before extra paths and the rest of the site-package paths).
 
+  * Running "bin/buildout -v" will include output alerting you to selected eggs
+    that came from site-packages, using the pattern
+    "Egg from site-packages: ...".
+
   * Fix an error when at least two dependencies were in a shared location like
     site-packages, and the first one met the "versions" setting.  The first
     dependency would be added, but subsequent dependencies from the same

Modified: zc.buildout/branches/gary-5-show-site-packages-eggs/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/branches/gary-5-show-site-packages-eggs/src/zc/buildout/easy_install.py	2009-09-25 22:06:38 UTC (rev 104553)
+++ zc.buildout/branches/gary-5-show-site-packages-eggs/src/zc/buildout/easy_install.py	2009-09-25 22:07:25 UTC (rev 104554)
@@ -788,6 +788,8 @@
                     pkg_resources.VersionConflict(dist, req), ws)
             requirements.extend(dist.requires(req.extras)[::-1])
             processed[req] = True
+            if dist.location in self._site_packages:
+                logger.debug('Egg from site-packages: %s', dist)
         return ws
 
     def build(self, spec, build_ext):

Modified: zc.buildout/branches/gary-5-show-site-packages-eggs/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/branches/gary-5-show-site-packages-eggs/src/zc/buildout/tests.py	2009-09-25 22:06:38 UTC (rev 104553)
+++ zc.buildout/branches/gary-5-show-site-packages-eggs/src/zc/buildout/tests.py	2009-09-25 22:07:25 UTC (rev 104554)
@@ -384,7 +384,71 @@
     Error: Couldn't find a distribution for 'demoneeded'.
     """
 
+def show_eggs_from_site_packages():
+    """
+Sometimes you want to know what eggs are coming from site-packages.  This
+might be for a diagnostic, or so that you can get a starting value for the
+allowed-eggs-from-site-packages option.  The -v flag will also include this
+information.
 
+Our "primed_executable" has the "demoneeded," "other," and "setuptools"
+packages available.  We'll ask for "other" and "bigdemo".
+
+Here's our set up.
+
+    >>> primed_executable = get_executable_with_site_packages()
+    >>> write('buildout.cfg',
+    ... '''
+    ... [buildout]
+    ... parts = eggs
+    ... prefer-final = true
+    ... find-links = %(link_server)s
+    ...
+    ... [primed_python]
+    ... executable = %(primed_executable)s
+    ...
+    ... [eggs]
+    ... recipe = zc.recipe.egg:eggs
+    ... python = primed_python
+    ... eggs = other
+    ...        bigdemo
+    ... ''' % globals())
+
+Now here is the output.  The lines that begin with "Egg from site-packages:"
+indicate the eggs from site-packages that have been selected.  You'll see
+we have two: other 1.0 and demoneeded 1.1.
+
+    >>> print system(primed_executable+" "+buildout+" -v")
+    Installing 'zc.buildout', 'setuptools'.
+    We have a develop egg: zc.buildout V
+    We have the best distribution that satisfies 'setuptools'.
+    Picked: setuptools = V
+    Installing 'zc.recipe.egg'.
+    We have a develop egg: zc.recipe.egg V
+    Installing eggs.
+    Installing 'other', 'bigdemo'.
+    We have the best distribution that satisfies 'other'.
+    Picked: other = 1.0
+    We have no distributions for bigdemo that satisfies 'bigdemo'.
+    Getting distribution for 'bigdemo'.
+    Got bigdemo 0.1.
+    Picked: bigdemo = 0.1
+    Egg from site-packages: other 1.0
+    Getting required 'demo'
+      required by bigdemo 0.1.
+    We have no distributions for demo that satisfies 'demo'.
+    Getting distribution for 'demo'.
+    Got demo 0.3.
+    Picked: demo = 0.3
+    Getting required 'demoneeded'
+      required by demo 0.3.
+    We have the best distribution that satisfies 'demoneeded'.
+    Picked: demoneeded = 1.1
+    Egg from site-packages: demoneeded 1.1
+    <BLANKLINE>
+
+    """
+
 def test_comparing_saved_options_with_funny_characters():
     """
 If an option has newlines, extra/odd spaces or a %, we need to make sure



More information about the checkins mailing list