[pypy-svn] r33909 - pypy/dist/pypy/tool/build/bin

guido at codespeak.net guido at codespeak.net
Mon Oct 30 16:28:36 CET 2006


Author: guido
Date: Mon Oct 30 16:28:34 2006
New Revision: 33909

Modified:
   pypy/dist/pypy/tool/build/bin/client
   pypy/dist/pypy/tool/build/bin/startcompile
Log:
(cfbolz, guido)
Adding real content to the zip now, making 'c' the default backend.


Modified: pypy/dist/pypy/tool/build/bin/client
==============================================================================
--- pypy/dist/pypy/tool/build/bin/client	(original)
+++ pypy/dist/pypy/tool/build/bin/client	Mon Oct 30 16:28:34 2006
@@ -14,6 +14,7 @@
 
 from pypy.translator.goal import targetpypystandalone
 from pypy.translator.driver import TranslationDriver
+from pypy.tool.udir import udir
 
 if config.server in ['localhost', '127.0.0.1']:
     gw = PopenGateway()
@@ -22,6 +23,16 @@
 channel = init(gw, config.system_config, path=config.path,
                 port=config.port)
 
+class ChannelWrapper(object):
+    def __init__(self, channel):
+        self.channel = channel
+        
+    def write(self, data):
+        self.channel.send(data)
+
+    def close(self):
+        self.channel.send(None)
+
 print channel.receive() # welcome message
 try:
     try:
@@ -47,15 +58,12 @@
                         default_goal='compile')
             driver.proceed()
 
-            # write the zip to the server in chunks to server
-            # XXX we're still faking this
-            zipfp = (path.packagedir / 'test/test.zip').open()
-            while True:
-                chunk = zipfp.read(BUFSIZE)
-                if not chunk:
-                    break
-                channel.send(chunk)
-            channel.send(None) # tell the server we're done
+            channelwrapper = ChannelWrapper(channel)
+            zip = ZipFile(channelwrapper, 'w')
+            for fpath in udir.visit():
+                zip.writestr(fpath.relto(outdir), fpath.read())
+            zip.close()
+
             print 'done with compilation, waiting for next'
     except EOFError:
         sys.exit()

Modified: pypy/dist/pypy/tool/build/bin/startcompile
==============================================================================
--- pypy/dist/pypy/tool/build/bin/startcompile	(original)
+++ pypy/dist/pypy/tool/build/bin/startcompile	Mon Oct 30 16:28:34 2006
@@ -11,7 +11,6 @@
     from pypy.config.config import to_optparse
 
     optparser = to_optparse(config.system_config)
-    
     to_optparse(config.compile_config, parser=optparser)
 
     (options, args) = optparser.parse_args()



More information about the Pypy-commit mailing list