[pypy-svn] r35833 - in pypy/dist/pypy/tool/build: . bin
guido at codespeak.net
guido at codespeak.net
Sat Dec 16 15:30:58 CET 2006
Author: guido
Date: Sat Dec 16 15:30:55 2006
New Revision: 35833
Modified:
pypy/dist/pypy/tool/build/bin/client
pypy/dist/pypy/tool/build/build.py
pypy/dist/pypy/tool/build/client.py
Log:
Added nasty hack to get rid of some code in pypy (using string replace) that
used os.write during compilation (freezing the sandbox), added str() function
to BuildRequest to not have so much blather in the logs (less verbose than the
'full' repr), added some missing channelwrapper.close() call that made the
compilations block before the logs were sent over. The build farm now works
(at least mostly) by just following the 'instructions' ('run bin/* scripts').
Modified: pypy/dist/pypy/tool/build/bin/client
==============================================================================
--- pypy/dist/pypy/tool/build/bin/client (original)
+++ pypy/dist/pypy/tool/build/bin/client Sat Dec 16 15:30:55 2006
@@ -11,6 +11,19 @@
from pypy.tool.build import build
from pypy.config.config import to_optparse, Config
+# XXX complete and total utter hack!!! to get some stuff out of pypy that
+# basically freezes our execnet sandbox (because of using os.write to stderr
+# and stuff)
+replace_code_hack = """\
+path1 = '%s/pypy/translator/goal/targetpypystandalone.py' % (pypath,)
+data = open(path1).read()
+data = data.replace('os.write', 'pass # os.write')
+open(path1, 'w').write(data)
+
+path2 = '%s/pypy/translator/goal/app_basic_example.py' % (pypath,)
+open(path2, 'w').write('6 * 7\\n')
+"""
+
def compile(wc, compileinfo):
code = """\
import sys
@@ -20,6 +33,9 @@
# interpolating the path
pypath = %r
+# XXX replace hack
+%s
+
sys.path = [pypath] + sys.path
os.chdir(pypath)
@@ -29,14 +45,11 @@
# interpolating config
compileinfo = %r
+# log locally too
log = open('/tmp/buildclient.log', 'a')
outbuffer = OutputBuffer(log)
-old_stdout = sys.__stdout__
-old_stderr = sys.__stderr__
sys.stdout = outbuffer
sys.stderr = outbuffer
-sys.__stdout__ = outbuffer
-sys.__stderr__ = outbuffer
try:
try:
from pypy.interpreter.error import OperationError
@@ -67,8 +80,6 @@
else:
channel.send(str(udir))
finally:
- sys.__stdout__ = old_stdout
- sys.__stderr__ = old_stderr
sys.stdout = sys.__stdout__
sys.stderr = sys.__stderr__
log.close()
@@ -78,10 +89,15 @@
gw = PopenGateway()
buffercode = py.magic.autopath().dirpath().dirpath()\
.join('outputbuffer.py').read()
- interpolated = code % (str(wc), buffercode, compileinfo)
+ interpolated = code % (str(wc), replace_code_hack, buffercode, compileinfo)
channel = gw.remote_exec(interpolated)
- upath = channel.receive()
- output = channel.receive()
+ try:
+ upath = channel.receive()
+ output = channel.receive()
+ except channel.RemoteError, e:
+ print 'Remote exception:'
+ print str(e)
+ return (None, str(e))
channel.close()
return upath, output
Modified: pypy/dist/pypy/tool/build/build.py
==============================================================================
--- pypy/dist/pypy/tool/build/build.py (original)
+++ pypy/dist/pypy/tool/build/build.py Sat Dec 16 15:30:55 2006
@@ -83,7 +83,12 @@
self.svnrev = svnrev
self.revrange = revrange
+ def __str__(self):
+ return '<BuildRequest %s:%s>' % (self.svnurl, self.normalized_rev)
+
def __repr__(self):
+ """ the result of this method can be exec-ed when build.py is imported
+ """
return 'build.BuildRequest(%r, %r, %r, %r, %r, %r)' % (
self.email, self.sysinfo, self.compileinfo, self.svnurl,
self.svnrev, self.revrange)
Modified: pypy/dist/pypy/tool/build/client.py
==============================================================================
--- pypy/dist/pypy/tool/build/client.py (original)
+++ pypy/dist/pypy/tool/build/client.py Sat Dec 16 15:30:55 2006
@@ -129,4 +129,5 @@
print exc
continue
zip.close()
+ channelwrapper.close()
More information about the Pypy-commit
mailing list