[Checkins] SVN: zc.buildout/trunk/src/zc/buildout/ Fixes #113085

Alexandru Plugaru alexandru.plugaru at gmail.com
Tue Mar 15 13:09:45 EDT 2011


Log message for revision 120954:
  Fixes #113085

Changed:
  U   zc.buildout/trunk/src/zc/buildout/buildout.py
  U   zc.buildout/trunk/src/zc/buildout/easy_install.py
  U   zc.buildout/trunk/src/zc/buildout/testing.py
  U   zc.buildout/trunk/src/zc/buildout/update.txt

-=-
Modified: zc.buildout/trunk/src/zc/buildout/buildout.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/buildout.py	2011-03-15 16:59:49 UTC (rev 120953)
+++ zc.buildout/trunk/src/zc/buildout/buildout.py	2011-03-15 17:09:43 UTC (rev 120954)
@@ -35,6 +35,7 @@
 import tempfile
 import UserDict
 import warnings
+import subprocess
 import zc.buildout
 import zc.buildout.download
 import zc.buildout.easy_install
@@ -49,9 +50,6 @@
 
 is_jython = sys.platform.startswith('java')
 
-if is_jython:
-    import subprocess
-
 _sys_executable_has_broken_dash_S = (
     zc.buildout.easy_install._has_broken_dash_S(sys.executable))
 
@@ -952,12 +950,7 @@
         # library) then that should be fine.
         env = os.environ.copy()
         env['PYTHONPATH'] = partsdir
-        if is_jython:
-            sys.exit(
-                subprocess.Popen(
-                    [sys.executable] + list(args), env=env).wait())
-        else:
-            sys.exit(os.spawnve(os.P_WAIT, sys.executable, args, env))
+        sys.exit(subprocess.Popen(args, env=env).wait())
 
     def _load_extensions(self):
         __doing__ = 'Loading extensions.'
@@ -1802,14 +1795,12 @@
             _error('invalid command:', command)
     else:
         command = 'install'
-
+    
     try:
         try:
             buildout = Buildout(config_file, options,
                                 user_defaults, windows_restart, command)
             getattr(buildout, command)(args)
-        except SystemExit:
-            pass
         except Exception, v:
             _doing()
             exc_info = sys.exc_info()

Modified: zc.buildout/trunk/src/zc/buildout/easy_install.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/easy_install.py	2011-03-15 16:59:49 UTC (rev 120953)
+++ zc.buildout/trunk/src/zc/buildout/easy_install.py	2011-03-15 17:09:43 UTC (rev 120954)
@@ -1181,13 +1181,12 @@
                 args[1] == '-v'
         if log_level < logging.DEBUG:
             logger.debug("in: %r\n%s", directory, ' '.join(args))
-
-        if is_jython:
-            assert subprocess.Popen([_safe_arg(executable)] + args).wait() == 0
-        else:
-            assert os.spawnl(os.P_WAIT, executable, _safe_arg(executable),
-                             *args) == 0
-
+        
+        try:
+            subprocess.check_call([_safe_arg(executable)] + args)
+        except subprocess.CalledProcessError:
+            raise zc.buildout.UserError("Installing develop egg failed")
+            
         return _copyeggs(tmp3, dest, '.egg-link', undo)
 
     finally:

Modified: zc.buildout/trunk/src/zc/buildout/testing.py
===================================================================
--- zc.buildout/trunk/src/zc/buildout/testing.py	2011-03-15 16:59:49 UTC (rev 120953)
+++ zc.buildout/trunk/src/zc/buildout/testing.py	2011-03-15 17:09:43 UTC (rev 120954)
@@ -211,9 +211,10 @@
 
     raise ValueError(
         "Couldn't figure out the executable for Python %(version)s.\n"
-        "Set the environment variable PYTHON%(version)s to the location\n"
+        "Set the environment variable PYTHON%(envversion)s to the location\n"
         "of the Python %(version)s executable before running the tests."
-        % {'version': version})
+        % {'version': version,
+           'envversion': env_friendly_version})
 
 def wait_until(label, func, *args, **kw):
     if 'timeout' in kw:

Modified: zc.buildout/trunk/src/zc/buildout/update.txt
===================================================================
--- zc.buildout/trunk/src/zc/buildout/update.txt	2011-03-15 16:59:49 UTC (rev 120953)
+++ zc.buildout/trunk/src/zc/buildout/update.txt	2011-03-15 17:09:43 UTC (rev 120954)
@@ -261,3 +261,36 @@
            'bootstrap without --accept-buildout-test-releases (-t) to return to '
            'default behavior.')
     ...
+
+If the update process for buildout or setuptools fails the error should be
+caught (displaying a warning) and the rest of the buildout update process
+should continue.
+
+    >>> version = sys.version_info[0:2]
+    >>> egg = new_releases + '/zc.buildout-99.99-py%s.%s.egg ' % version
+    >>> copy_egg = new_releases + '/zc.buildout-1000-py%s.%s.egg ' % version
+    >>> system('cp ' + egg  + copy_egg)
+    ''
+
+Create a broken egg
+
+    >>> mkdir(sample_buildout, 'broken')
+    >>> write(sample_buildout, 'broken', 'setup.py', "import broken_egg\n")
+    >>> write(sample_buildout, 'buildout.cfg',
+    ... """
+    ... [buildout]
+    ... find-links = %(new_releases)s
+    ... index = %(new_releases)s
+    ... parts = show-versions
+    ... develop =
+    ...   broken
+    ...
+    ... [broken]
+    ... recipe = zc.recipe.egg
+    ... eggs = broken
+    ... """ % dict(new_releases=new_releases))
+    >>> import subprocess
+    >>> subprocess.check_call([buildout])
+    Traceback (most recent call last):
+        ...
+    CalledProcessError: Command '['/sample-buildout/bin/buildout']' returned non-zero exit status 1



More information about the checkins mailing list