[Checkins] SVN: zc.buildout/trunk/src/zc/buildout/ Added an option to change the default policy for unzipping zip-safe

Jim Fulton jim at zope.com
Fri Jul 18 16:51:53 EDT 2008


Log message for revision 88550:
  Added an option to change the default policy for unzipping zip-safe
  eggs.
  

Changed:
  U   zc.buildout/trunk/src/zc/buildout/buildout.py
  U   zc.buildout/trunk/src/zc/buildout/tests.py
  A   zc.buildout/trunk/src/zc/buildout/unzip.txt

-=-
Modified: zc.buildout/trunk/src/zc/buildout/buildout.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/buildout.py	2008-07-18 20:51:27 UTC (rev 88549)
+++ zc.buildout/trunk/src/zc/buildout/buildout.py	2008-07-18 20:51:43 UTC (rev 88550)
@@ -240,6 +240,15 @@
             if install_from_cache == 'true':
                 zc.buildout.easy_install.install_from_cache(True)
 
+
+        always_unzip = options.get('unzip')
+        if always_unzip:
+            if always_unzip not in ('true', 'false'):
+                self._error('Invalid value for unzip option: %s',
+                            always_unzip)
+            if always_unzip == 'true':
+                zc.buildout.easy_install.always_unzip(True)
+
         # "Use" each of the defaults so they aren't reported as unused options.
         for name in _buildout_default_options:
             options[name]

Modified: zc.buildout/trunk/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/tests.py	2008-07-18 20:51:27 UTC (rev 88549)
+++ zc.buildout/trunk/src/zc/buildout/tests.py	2008-07-18 20:51:43 UTC (rev 88550)
@@ -2657,7 +2657,7 @@
         
         doctest.DocFileSuite(
             'easy_install.txt', 'downloadcache.txt', 'dependencylinks.txt',
-            'allowhosts.txt',
+            'allowhosts.txt', 'unzip.txt',
             setUp=easy_install_SetUp,
             tearDown=zc.buildout.testing.buildoutTearDown,
 

Added: zc.buildout/trunk/src/zc/buildout/unzip.txt
===================================================================
--- zc.buildout/trunk/src/zc/buildout/unzip.txt	                        (rev 0)
+++ zc.buildout/trunk/src/zc/buildout/unzip.txt	2008-07-18 20:51:43 UTC (rev 88550)
@@ -0,0 +1,55 @@
+Always unzipping eggs
+=====================
+
+By default, zc.buildout doesn't unzip zip-safe eggs.
+
+    >>> write('buildout.cfg',
+    ... '''
+    ... [buildout]
+    ... parts = eggs
+    ... find-links = %(link_server)s
+    ...
+    ... [eggs]
+    ... recipe = zc.recipe.egg
+    ... eggs = demo
+    ... ''' % globals())
+
+    >>> _ = system(buildout)
+    >>> ls('eggs')
+    -  demo-0.4c1-py2.4.egg
+    -  demoneeded-1.2c1-py2.4.egg
+    d  setuptools-0.6c8-py2.4.egg
+    -  zc.buildout.egg-link
+
+This follows the
+policy followed by setuptools itself.  Experience shows this policy
+to to be inconvenient.  Zipped eggs make debugging more difficult and
+often import more slowly.
+
+You can include an unzip option in the buildout section to change the
+default unzipping policy.
+
+    >>> write('buildout.cfg',
+    ... '''
+    ... [buildout]
+    ... parts = eggs
+    ... find-links = %(link_server)s
+    ... unzip = true
+    ...
+    ... [eggs]
+    ... recipe = zc.recipe.egg
+    ... eggs = demo
+    ... ''' % globals())
+
+
+    >>> import os
+    >>> for name in os.listdir('eggs'):
+    ...     if name.startswith('demo'):
+    ...         remove('eggs', name)
+
+    >>> _ = system(buildout)
+    >>> ls('eggs')
+    d  demo-0.4c1-py2.4.egg
+    d  demoneeded-1.2c1-py2.4.egg
+    d  setuptools-0.6c8-py2.4.egg
+    -  zc.buildout.egg-link


Property changes on: zc.buildout/trunk/src/zc/buildout/unzip.txt
___________________________________________________________________
Name: svn:eol-style
   + native



More information about the Checkins mailing list