[pypy-svn] r35419 - in pypy/dist/pypy/tool/build: . bin
afayolle at codespeak.net
afayolle at codespeak.net
Thu Dec 7 11:02:58 CET 2006
Author: afayolle
Date: Thu Dec 7 11:02:55 2006
New Revision: 35419
Modified:
pypy/dist/pypy/tool/build/bin/client
pypy/dist/pypy/tool/build/client.py
Log:
Moved some code from bin/client to client.py
Dropped ChannelWrapper, because ZipFile calls g.tell() and I could not figure how to emulate that. Fixed other zip related bugs.
Note: I get a zip, but it does not contain pypy-c, I'll look into this.
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 7 11:02:55 2006
@@ -5,34 +5,28 @@
import path
import sys
import random
-from pypy.tool.build import config
+from pypy.tool.build import config as buildconfig
from py.execnet import SshGateway, PopenGateway
-from pypy.tool.build.client import init
+from pypy.tool.build.client import init, zip_result
from pypy.config.config import to_optparse, Config
from pypy.config import pypyoption
from pypy.translator.goal import targetpypystandalone
from pypy.translator.driver import TranslationDriver
from pypy.tool.udir import udir
-from zipfile import ZipFile
-if config.server in ['localhost', '127.0.0.1']:
+if buildconfig.server in ['localhost', '127.0.0.1']:
gw = PopenGateway()
else:
- gw = SshGateway(config.server)
-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)
+ gw = SshGateway(buildconfig.server)
+
+channel = init(gw,
+ buildconfig.system_config,
+ path=buildconfig.path,
+ port=buildconfig.port)
+
- def close(self):
- self.channel.send(None)
print channel.receive() # welcome message
try:
@@ -59,12 +53,8 @@
default_goal='compile')
driver.proceed(['compile'])
- channelwrapper = ChannelWrapper(channel)
- zip = ZipFile(channelwrapper, 'w')
- for fpath in udir.visit():
- zip.writestr(fpath.relto(udir), fpath.read())
- zip.close()
-
+ zip_result(udir, channel)
+
print 'done with compilation, waiting for next'
except EOFError:
sys.exit()
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 7 11:02:55 2006
@@ -1,5 +1,8 @@
-import time
import thread
+import py
+from zipfile import ZipFile
+from cStringIO import StringIO
+
class PPBClient(object):
def __init__(self, channel, sysinfo, testing=False):
@@ -76,7 +79,6 @@
"""
def init(gw, sysconfig, path=None, port=12321, testing=False):
from pypy.tool.build import execnetconference
- from pypy.tool.build import server
from pypy.config.config import make_dict
if path is None:
@@ -86,3 +88,18 @@
conference = execnetconference.conference(gw, port, False)
channel = conference.remote_exec(initcode % (path, sysinfo, testing))
return channel
+
+def zip_result(res_dir, channel):
+ # channelwrapper = ChannelWrapper(channel)
+ buf = StringIO()
+ zip = ZipFile(buf, 'w')
+ for fpath in res_dir.visit():
+ try:
+ zip.writestr(fpath.relto(res_dir), fpath.read())
+ except (py.error.ENOENT, py.error.EISDIR), exc:
+ print exc
+ continue
+ zip.close()
+ channel.send(buf.getvalue())
+ channel.send(None)
+
More information about the Pypy-commit
mailing list