[Checkins] SVN: zc.buildout/trunk/ revert changes moved to branch gotcha-timeout-cfg

Godefroid Chapelle gotcha at bubblenet.be
Fri Apr 16 05:47:28 EDT 2010


Log message for revision 110962:
  revert changes moved to branch gotcha-timeout-cfg
  

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

-=-
Modified: zc.buildout/trunk/CHANGES.txt
===================================================================
--- zc.buildout/trunk/CHANGES.txt	2010-04-16 09:45:10 UTC (rev 110961)
+++ zc.buildout/trunk/CHANGES.txt	2010-04-16 09:47:28 UTC (rev 110962)
@@ -4,11 +4,7 @@
 1.4.4 (?)
 =========
 
-New feature:
 
-- Added buildout:socket-timout option so that socket timeout can be configured
-  both from command line and from config files. (gotcha)
-
 1.4.3 (2009-12-10)
 ==================
 

Modified: zc.buildout/trunk/src/zc/buildout/buildout.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/buildout.py	2010-04-16 09:45:10 UTC (rev 110961)
+++ zc.buildout/trunk/src/zc/buildout/buildout.py	2010-04-16 09:47:28 UTC (rev 110962)
@@ -32,7 +32,6 @@
 import re
 import shutil
 import sys
-import socket
 import tempfile
 import UserDict
 import zc.buildout
@@ -122,21 +121,9 @@
     'executable': sys.executable,
     'log-level': 'INFO',
     'log-format': '',
-    'socket-timeout': '',
     }, 'DEFAULT_VALUE')
 
-DEFAULT_SOCKET_TIMEOUT = socket.getdefaulttimeout()
 
-def _setup_socket_timeout(timeout_string):
-    try:
-        timeout = int(timeout_string)
-    except ValueError:
-        _error("Timeout value must be numeric [%s]." % timeout_string)
-    current_timeout = socket.getdefaulttimeout()
-    if current_timeout <> timeout:
-        socket.setdefaulttimeout(timeout)
-
-
 class Buildout(UserDict.DictMixin):
 
     def __init__(self, config_file, cloptions,
@@ -258,7 +245,6 @@
                                                 options['installed'])
 
         self._setup_logging()
-        self._display_socket_timeout()
 
         offline = options.get('offline', 'false')
         if offline not in ('true', 'false'):
@@ -763,12 +749,6 @@
     def _error(self, message, *args):
         raise zc.buildout.UserError(message % args)
 
-    def _display_socket_timeout(self):
-        current_timeout = socket.getdefaulttimeout()
-        if current_timeout <> DEFAULT_SOCKET_TIMEOUT:
-            info_msg = 'Socket timeout is set to %d seconds.' % current_timeout
-            self._logger.info(info_msg)
-
     def _setup_logging(self):
         root_logger = logging.getLogger()
         self._logger = logging.getLogger('zc.buildout')
@@ -1336,18 +1316,13 @@
         os.remove(path)
 
     extends = extended_by = None
-    socket_timeout = None
     for section in parser.sections():
         options = dict(parser.items(section))
         if section == 'buildout':
             extends = options.pop('extends', extends)
             extended_by = options.pop('extended-by', extended_by)
-            socket_timeout = options.pop('socket-timeout', socket_timeout)
         result[section] = options
 
-    if socket_timeout is not None:
-        _setup_socket_timeout(socket_timeout)
-
     result = _annotate(result, filename)
 
     if root_config_file and 'buildout' in result:
@@ -1640,11 +1615,16 @@
                             _error("No file name specified for option", orig_op)
                 elif op_ == 't':
                     try:
-                        timeout_string = args.pop(0)
-                        _setup_socket_timeout(timeout_string)
-                        options.append(('buildout', 'socket-timeout', timeout_string))
+                        timeout = int(args.pop(0))
                     except IndexError:
-                        _error("No timeout value specified for option t", orig_op)
+                        _error("No timeout value specified for option", orig_op)
+                    except ValueError:
+                        _error("No timeout value must be numeric", orig_op)
+
+                    import socket
+                    print 'Setting socket time out to %d seconds' % timeout
+                    socket.setdefaulttimeout(timeout)
+
             elif op:
                 if orig_op == '--help':
                     _help()

Modified: zc.buildout/trunk/src/zc/buildout/buildout.txt
===================================================================
--- zc.buildout/trunk/src/zc/buildout/buildout.txt	2010-04-16 09:45:10 UTC (rev 110961)
+++ zc.buildout/trunk/src/zc/buildout/buildout.txt	2010-04-16 09:47:28 UTC (rev 110962)
@@ -748,8 +748,6 @@
         DEFAULT_VALUE
     python= buildout
         DEFAULT_VALUE
-    socket-timeout= 
-        DEFAULT_VALUE
     <BLANKLINE>
     [data-dir]
     path= foo bins
@@ -1493,49 +1491,6 @@
     op3 b2 3
     recipe recipes:debug
 
-Socket timeout
---------------
-
-The timeout of the connections to egg and configuration servers can be
-configured in the buildout section. Its value is configured in seconds.
-
-    >>> write(sample_buildout, 'buildout.cfg',
-    ... """
-    ... [buildout]
-    ... socket-timeout = 5
-    ... develop = recipes
-    ... parts = debug
-    ...
-    ... [debug]
-    ... recipe = recipes:debug
-    ... op = timeout
-    ... """)
-
-    >>> print system(buildout),
-    Socket timeout is set to 5 seconds.
-    Develop: '/sample-buildout/recipes'
-    Uninstalling debug.
-    Installing debug.
-    op timeout
-    recipe recipes:debug
-
-If socket-timeout is not numeric, an error message is issued.
-
-    >>> write(sample_buildout, 'buildout.cfg',
-    ... """
-    ... [buildout]
-    ... socket-timeout = 5s
-    ... develop = recipes
-    ... parts = debug
-    ...
-    ... [debug]
-    ... recipe = recipes:debug
-    ... op = timeout
-    ... """)
-
-    >>> print system(buildout),
-    Error: Timeout value must be numeric [5s].
-
 Uninstall recipes
 -----------------
 
@@ -2258,7 +2213,6 @@
     parts =
     parts-directory = /sample-buildout/parts
     python = buildout
-    socket-timeout = 
     verbosity = 20
     <BLANKLINE>
 



More information about the checkins mailing list