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

Godefroid Chapelle gotcha at bubblenet.be
Sun Mar 29 17:22:49 EDT 2009


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

Changed:
  U   zc.buildout/branches/help-api/src/zc/buildout/buildout.py
  U   zc.buildout/branches/help-api/src/zc/buildout/tests.py
  A   zc.buildout/branches/help-api/src/zc/buildout/unzip.txt

-=-
Modified: zc.buildout/branches/help-api/src/zc/buildout/buildout.py
===================================================================
--- zc.buildout/branches/help-api/src/zc/buildout/buildout.py	2009-03-29 21:22:42 UTC (rev 98518)
+++ zc.buildout/branches/help-api/src/zc/buildout/buildout.py	2009-03-29 21:22:49 UTC (rev 98519)
@@ -239,6 +239,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/branches/help-api/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/branches/help-api/src/zc/buildout/tests.py	2009-03-29 21:22:42 UTC (rev 98518)
+++ zc.buildout/branches/help-api/src/zc/buildout/tests.py	2009-03-29 21:22:49 UTC (rev 98519)
@@ -3067,7 +3067,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/branches/help-api/src/zc/buildout/unzip.txt
===================================================================
--- zc.buildout/branches/help-api/src/zc/buildout/unzip.txt	                        (rev 0)
+++ zc.buildout/branches/help-api/src/zc/buildout/unzip.txt	2009-03-29 21:22:49 UTC (rev 98519)
@@ -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



More information about the Checkins mailing list