[pypy-svn] r36020 - in pypy/dist/pypy/tool/build: . bin test

guido at codespeak.net guido at codespeak.net
Thu Dec 28 14:43:50 CET 2006


Author: guido
Date: Thu Dec 28 14:43:47 2006
New Revision: 36020

Modified:
   pypy/dist/pypy/tool/build/bin/client
   pypy/dist/pypy/tool/build/build.py
   pypy/dist/pypy/tool/build/client.py
   pypy/dist/pypy/tool/build/config.py
   pypy/dist/pypy/tool/build/test/test_build.py
Log:
Added a .error attribute on BuildPath, which contains an instance of the type
of error that has occurred on the client (can be used for more advanced error
handling later). Also some small cleanups, and fixed a path in the config.


Modified: pypy/dist/pypy/tool/build/bin/client
==============================================================================
--- pypy/dist/pypy/tool/build/bin/client	(original)
+++ pypy/dist/pypy/tool/build/bin/client	Thu Dec 28 14:43:47 2006
@@ -82,3 +82,4 @@
     from pypy.tool.build.client import main
 
     main(config, path, compile)
+

Modified: pypy/dist/pypy/tool/build/build.py
==============================================================================
--- pypy/dist/pypy/tool/build/build.py	(original)
+++ pypy/dist/pypy/tool/build/build.py	Thu Dec 28 14:43:47 2006
@@ -36,7 +36,7 @@
           progress
         
     """
-    
+
     def _request(self):
         req = self.join('request')
         if not req.check():
@@ -77,6 +77,25 @@
         return not not self.log
     done = property(_done)
 
+    _reg_error = py.std.re.compile(r'uring compilation:\n([^:]+): (.*)')
+    def _error(self):
+        if self.done and not self.zipfile.size():
+            log = self.log
+            match = self._reg_error.search(log)
+            if not match:
+                return Exception
+            exc = match.group(1)
+            msg = match.group(2)
+            try:
+                exc = eval('%s(%r)' % (exc, msg))
+            except Exception, e:
+                print e
+                exc = Exception('%s: %s' % (exc, msg))
+            return exc
+        return None
+
+    error = property(_error)
+
 class BuildRequest(object):
     """ build request data
 

Modified: pypy/dist/pypy/tool/build/client.py
==============================================================================
--- pypy/dist/pypy/tool/build/client.py	(original)
+++ pypy/dist/pypy/tool/build/client.py	Thu Dec 28 14:43:47 2006
@@ -44,7 +44,8 @@
                     try:
                         chunk = self.channel.receive()
                     except EOFError:
-                        # stop compilation, client has disconnected
+                        # stop compilation, client has disconnected (server
+                        # will check the connection after a while and clean up)
                         return
                     # end of data is marked by sending a None
                     if chunk is None:

Modified: pypy/dist/pypy/tool/build/config.py
==============================================================================
--- pypy/dist/pypy/tool/build/config.py	(original)
+++ pypy/dist/pypy/tool/build/config.py	Thu Dec 28 14:43:47 2006
@@ -28,10 +28,10 @@
 buildpath = packageparent.ensure('/pypy/tool/build/builds', dir=True)
 mailhost = 'localhost'
 mailport = 25
-mailfrom = 'pypybuilds at codespeak.net'
+mailfrom = 'guido at codespeak.net'
 
 # settings for the tests
-testpath = [str(py.magic.autopath().dirpath().dirpath())]
+testpath = [str(py.magic.autopath().dirpath().dirpath().dirpath().dirpath())]
 
 # this var is only used below
 svnroot = 'http://codespeak.net/svn/pypy'

Modified: pypy/dist/pypy/tool/build/test/test_build.py
==============================================================================
--- pypy/dist/pypy/tool/build/test/test_build.py	(original)
+++ pypy/dist/pypy/tool/build/test/test_build.py	Thu Dec 28 14:43:47 2006
@@ -151,3 +151,31 @@
                              testurl + '/baz', 1, 0)
     assert not br8.has_satisfying_data(br1)
 
+def test_buildrequest_error():
+    tempdir = py.test.ensuretemp('pypybuilder-buildpath')
+    bp = build.BuildPath(str(tempdir / 'test_error'))
+    assert bp.error is None
+    bp.log = """
+==============================================================================
+Exception during compilation:
+SyntaxError: foo
+...
+traceback here
+...
+==============================================================================
+"""
+    e = bp.error
+    assert e.__class__ == SyntaxError
+    assert str(e) == 'foo'
+    bp.log = """
+==============================================================================
+Exception during compilation:
+FooBarException: baz
+...
+traceback here
+...
+"""
+    e = bp.error
+    assert e.__class__ == Exception
+    assert str(e) == 'FooBarException: baz'
+



More information about the Pypy-commit mailing list