[pypy-svn] r41216 - in pypy/dist/pypy/tool/build: . testproject/bin

guido at codespeak.net guido at codespeak.net
Fri Mar 23 21:35:42 CET 2007


Author: guido
Date: Fri Mar 23 21:35:39 2007
New Revision: 41216

Modified:
   pypy/dist/pypy/tool/build/buildserver.py
   pypy/dist/pypy/tool/build/compile.py
   pypy/dist/pypy/tool/build/testproject/bin/metaserver.py
Log:
Reconnecting build server on broken connections, fixed some problems in
the code I added to compile.py to support multibuild.py, added autopath.py
to the test project's metaserver script.


Modified: pypy/dist/pypy/tool/build/buildserver.py
==============================================================================
--- pypy/dist/pypy/tool/build/buildserver.py	(original)
+++ pypy/dist/pypy/tool/build/buildserver.py	Fri Mar 23 21:35:39 2007
@@ -3,6 +3,7 @@
 from zipfile import ZipFile, ZIP_DEFLATED
 from cStringIO import StringIO
 from pypy.tool.build import build
+from py.execnet import SshGateway, PopenGateway
 
 class BuildServer(object):
     def __init__(self, channel, sysinfo, hostname, testing_sleeptime=False):
@@ -150,10 +151,7 @@
             return parent.ensure(dirname, dir=True)
         i += 1
 
-def main(config, path, compilefunc):
-    """ build server bootstrapping and main loop """
-    from py.execnet import SshGateway, PopenGateway
-
+def connect(config):
     if config.server in ['localhost', '127.0.0.1']:
         gw = PopenGateway()
     else:
@@ -166,12 +164,22 @@
                    config.system_config,
                    path=config.path,
                    port=config.port)
+    return gw, channel
+
+def main(config, path, compilefunc):
+    """ build server bootstrapping and main loop """
+    gw, channel = connect(config)
 
     print 'connected'
     try:
         while 1:
             # receive compile requests
-            request = channel.receive()
+            try:
+                request = channel.receive()
+            except EOFError:
+                gw.exit()
+                gw, channel = connect(config)
+
             if not isinstance(request, str):
                 raise ValueError(
                     'received wrong unexpected data of type %s' % (

Modified: pypy/dist/pypy/tool/build/compile.py
==============================================================================
--- pypy/dist/pypy/tool/build/compile.py	(original)
+++ pypy/dist/pypy/tool/build/compile.py	Fri Mar 23 21:35:39 2007
@@ -173,13 +173,14 @@
     print 'going to start compile'
     ret = msa.start_compile(request)
     reqid = ret['id']
-    if ret['path']:
+    path = ret['path']
+    message = ret['message']
+    if path:
         print ('a suitable result is already available, you can '
-               'find it at "%s" on %s' % (ret['path'],
-                                          config.server))
+               'find it at "%s" on %s' % (path, config.server))
     else:
-        print ret['message']
-        print 'the id of this build request is: %s' % (ret['id'],)
+        print message
+        print 'the id of this build request is: %s' % (reqid,)
         inprogress = True
 
     if foreground and inprogress:
@@ -195,12 +196,12 @@
             print 'error:', error
             return (False, error)
         else:
-            zipfile = py.path.local('pypy-%s.zip' % (retid,))
+            zipfile = py.path.local('pypy-%s.zip' % (reqid,))
             msa.save_zip(zipfile)
             print 'done, the result can be found in %s' % (zipfile,)
-            return (True, ret['message'])
-    elif not foreground and inprogress and not ret['path']:
+            return (True, message)
+    elif not foreground and inprogress and not path:
         print 'you will be mailed once it\'s ready'
     elif foreground:
-        return (False, ret['message'])
+        return (False, message)
 

Modified: pypy/dist/pypy/tool/build/testproject/bin/metaserver.py
==============================================================================
--- pypy/dist/pypy/tool/build/testproject/bin/metaserver.py	(original)
+++ pypy/dist/pypy/tool/build/testproject/bin/metaserver.py	Fri Mar 23 21:35:39 2007
@@ -1,5 +1,6 @@
 #!/usr/bin/env python
 
+import autopath
 from pypy.tool.build.testproject import config
 from pypy.tool.build.metaserver import main
 



More information about the Pypy-commit mailing list