[pypy-svn] r40490 - in pypy/dist/pypy/tool/build/web: . templates test
cfbolz at codespeak.net
cfbolz at codespeak.net
Wed Mar 14 16:37:44 CET 2007
Author: cfbolz
Date: Wed Mar 14 16:37:43 2007
New Revision: 40490
Modified:
pypy/dist/pypy/tool/build/web/app.py
pypy/dist/pypy/tool/build/web/templates/build.html
pypy/dist/pypy/tool/build/web/test/test_app.py
Log:
rather hairy code to format the chosen options. Guido, please look at this.
Modified: pypy/dist/pypy/tool/build/web/app.py
==============================================================================
--- pypy/dist/pypy/tool/build/web/app.py (original)
+++ pypy/dist/pypy/tool/build/web/app.py Wed Mar 14 16:37:43 2007
@@ -30,6 +30,44 @@
headers.update(get_nocache_headers())
return headers
+def format_compileinfo(compileinfo):
+ # XXX hack and partially copied from Config.__str__
+ from pypy.config.pypyoption import get_pypy_config
+ from pypy.config.config import Config
+ from pypy.translator.driver import DEFAULTS
+ config1 = get_pypy_config(DEFAULTS, translating=True)
+ config2 = get_pypy_config(DEFAULTS, translating=True)
+ config1.set(**compileinfo)
+ def add(c1, c2, path_upto_here="", outermost=False):
+ items = []
+ children = [(child._name, child)
+ for child in c1._cfgimpl_descr._children]
+ children.sort()
+ for name, child in children:
+ value = getattr(c1, name)
+ if isinstance(value, Config):
+ if path_upto_here:
+ subpath = path_upto_here + "." + name
+ else:
+ subpath = name
+ substr = add(value, getattr(c2, name), subpath)
+ if substr:
+ items.append("<li> [%s] <ul>" % (name, ))
+ items.append(" " + substr.replace("\n", "\n "))
+ items.append("</ul> </li>")
+ elif value == getattr(c2, name):
+ continue
+ else:
+ url = "http://codespeak.net/pypy/dist/pypy/doc/config/"
+ url += path_upto_here + "." + name + ".html"
+ items.append('<li> <a href="%s"> %s </a> = %s </li>' % (
+ url, name, value))
+ if outermost and not lines:
+ return ""
+ return "\n ".join(items)
+ return "<ul> %s </ul>" % (add(config1, config2, outermost=False), )
+
+
class ServerPage(object):
""" base class for pages that communicate with the server
"""
@@ -144,9 +182,7 @@
d['href'] = '/builds/%s' % (id,)
d.pop('sysinfo', None) # same as builder
d.pop('build_end_time', None) # it's still busy ;)
- # templesser doesn't understand dicts this way...
- d['compileinfo'] = [{'key': k, 'value': v} for (k, v) in
- d['compileinfo'].items()]
+ d['compileinfo'] = format_compileinfo(d['compileinfo'])
for key in ['request_time', 'build_start_time']:
if d[key]:
d[key] = time.strftime('%Y/%m/%d %H:%M:%S',
@@ -185,8 +221,7 @@
'build_end_time': format_time(br.build_end_time),
'sysinfo': [{'key': k, 'value': v} for (k, v) in
sorted(br.sysinfo.items())],
- 'compileinfo': [{'key': k, 'value': v} for (k, v) in
- sorted(br.compileinfo.items())],
+ 'compileinfo': format_compileinfo(br.compileinfo),
'status': bpinfo['status'],
'statusclass': bpinfo['status'].replace(' ', '_'),
'error': bpinfo.get('error', None),
Modified: pypy/dist/pypy/tool/build/web/templates/build.html
==============================================================================
--- pypy/dist/pypy/tool/build/web/templates/build.html (original)
+++ pypy/dist/pypy/tool/build/web/templates/build.html Wed Mar 14 16:37:43 2007
@@ -59,12 +59,7 @@
</div>
%(sysinfo)]b
<div class="title">compileinfo:</div>
- %(compileinfo)[b
- <div class="valuelist">
- <span class="smalltitle">%(key)s:</span>
- <span>%(value)s</span>
- </div>
- %(compileinfo)]b
+ %(compileinfo)s
<!--
%%(log)[c
<div>
Modified: pypy/dist/pypy/tool/build/web/test/test_app.py
==============================================================================
--- pypy/dist/pypy/tool/build/web/test/test_app.py (original)
+++ pypy/dist/pypy/tool/build/web/test/test_app.py Wed Mar 14 16:37:43 2007
@@ -122,7 +122,8 @@
def test_call(self):
class TestPage(BuildersInfoPage):
def get_buildersinfo(self):
- b = build.BuildRequest('foo at bar.com', {}, {'foo': 'bar'},
+ b = build.BuildRequest('foo at bar.com', {},
+ {'translation.gc': 'framework'},
'http://codespeak.net/svn/pypy/dist',
10, 2, 123456789)
binfo = b.todict()
@@ -155,7 +156,8 @@
class TestBuildPage(object):
def test_get_info(self):
- br = build.BuildRequest('foo at bar.com', {}, {'foo': 'bar'},
+ br = build.BuildRequest('foo at bar.com', {},
+ {'objspace.std.withrope': True},
'http://codespeak.net/svn/pypy/dist',
10, 2, 123456789)
server_channel.send(('add_queued', br.serialize()))
@@ -166,7 +168,8 @@
assert info['id'] == br.id()
def test_call(self):
- br = build.BuildRequest('foo at bar.com', {}, {'foo': 'bar'},
+ br = build.BuildRequest('foo at bar.com', {},
+ {'objspace.std.withmultidict': True},
'http://codespeak.net/svn/pypy/dist',
10, 2, 123456789)
server_channel.send(('add_queued', br.serialize()))
@@ -180,7 +183,8 @@
class TestBuildsIndexPage(object):
def test_get_builds(self):
- br = build.BuildRequest('foo at bar.com', {}, {'foo': 'bar'},
+ br = build.BuildRequest('foo at bar.com', {},
+ {'objspace.std.withmultidict': True},
'http://codespeak.net/svn/pypy/dist',
10, 2, 123456789)
server_channel.send(('add_queued', br.serialize()))
More information about the Pypy-commit
mailing list