[pypy-commit] buildbot default: some work on numready
fijal
noreply at buildbot.pypy.org
Mon Jan 23 00:46:34 CET 2012
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch:
Changeset: r609:ba9d28fbab20
Date: 2012-01-23 01:46 +0200
http://bitbucket.org/pypy/buildbot/changeset/ba9d28fbab20/
Log: some work on numready
diff --git a/numready.py b/numready.py
--- a/numready.py
+++ b/numready.py
@@ -15,7 +15,7 @@
import jinja2
-MODULE_SEARCH_CODE = """
+MODULE_SEARCH_CODE = '''
import types
import {modname} as numpy
@@ -27,22 +27,22 @@
if isinstance(obj, types.TypeType):
kind = "{kinds[TYPE]}"
print kind, ":", name
-"""
+'''
-ATTR_SEARCH_CODE = """
+ATTR_SEARCH_CODE = '''
import types
import {modname} as numpy
obj = getattr(numpy, "{name}")
for name in dir(obj):
- if name.startswith("_"):
- continue
+ #if name.startswith("_"):
+ # continue
sub_obj = getattr(obj, name)
kind = "{kinds[UNKNOWN]}"
if isinstance(sub_obj, types.TypeType):
kind = "{kinds[TYPE]}"
print kind, ":", name
-"""
+'''
KINDS = {
"UNKNOWN": "U",
@@ -62,6 +62,9 @@
h1 {
text-align: center;
}
+ h3 {
+ text-align: center;
+ }
table {
border: 8px solid #DFDECB;
margin: 30px auto;
@@ -74,7 +77,7 @@
padding: 4px 10px;
text-align: center;
}
- tr.exists {
+ .exists {
background-color: #337792;
color: white;
border: 1px solid #234F61;
@@ -83,27 +86,30 @@
</head>
<body>
<h1>NumPyPy Status</h1>
+ <h3>Overall: {{ msg }}</h3>
<table>
<thead>
<tr>
<th></th>
<th>PyPy</th>
+ <th></th>
+ <th>PyPy</th>
+ <th></th>
+ <th>PyPy</th>
+ <th></th>
+ <th>PyPy</th>
+ <th></th>
+ <th>PyPy</th>
</tr>
</thead>
<tbody>
- {% for item in all_items %}
- <tr{% if item.pypy_exists %} class="exists"{% endif %}>
- <th>{{ item.name }}</th>
- <td>{% if item.pypy_exists %}✔{% else %}✖{% endif %}</td>
+ {% for chunk in all_items %}
+ <tr>
+ {% for item in chunk %}
+ <th class='{{ item.cls }}'>{{ item.name }}</th>
+ <td class='{{ item.cls }}'>{{ item.symbol }}</td>
+ {% endfor %}
</tr>
- {% if item.subitems %}
- {% for item in item.subitems %}
- <tr{% if item.pypy_exists %} class="exists"{% endif %}>
- <th> {{ item.name }}</th>
- <td>{% if item.pypy_exists %}✔{% else %}✖{% endif %}</td>
- </tr>
- {% endfor %}
- {% endif %}
{% endfor %}
</tbody>
</table>
@@ -129,6 +135,9 @@
def add(self, item):
self._items[item] = item
+ def __len__(self):
+ return len(self._items)
+
class Item(object):
def __init__(self, name, kind, subitems=None):
self.name = name
@@ -139,14 +148,16 @@
return hash(self.name)
def __eq__(self, other):
+ if isinstance(other, str):
+ return self.name == other
return self.name == other.name
class ItemStatus(object):
- def __init__(self, name, pypy_exists, subitems=None):
+ def __init__(self, name, pypy_exists):
self.name = name
- self.pypy_exists = pypy_exists
- self.subitems = subitems
+ self.cls = 'exists' if pypy_exists else ''
+ self.symbol = u"✔" if pypy_exists else u'✖'
def __lt__(self, other):
return self.name < other.name
@@ -170,10 +181,21 @@
kind, name = line.split(" : ", 1)
subitems = None
if kind == KINDS["TYPE"]:
- subitems = find_numpy_attrs(python, modname, name)
+ if name in ['ndarray', 'dtype']:
+ subitems = find_numpy_attrs(python, modname, name)
items.add(Item(name, kind, subitems))
return items
+def split(lst):
+ SPLIT = 5
+ lgt = len(lst) // SPLIT + 1
+ l = [[] for i in range(lgt)]
+ for i in range(lgt):
+ for k in range(SPLIT):
+ if k * lgt + i < len(lst):
+ l[i].append(lst[k * lgt + i])
+ return l
+
def main(argv):
assert platform.python_implementation() == "PyPy"
@@ -181,25 +203,23 @@
pypy_items = find_numpy_items(sys.executable, "numpypy")
all_items = []
+ msg = '%d/%d names, %d/%d ndarray attributes, %d/%d dtype attributes' % (
+ len(pypy_items), len(cpy_items), len(pypy_items['ndarray'].subitems),
+ len(cpy_items['ndarray'].subitems), len(pypy_items['dtype'].subitems),
+ len(cpy_items['dtype'].subitems))
for item in cpy_items:
pypy_exists = item in pypy_items
- subitems = None
if item.subitems:
- subitems = []
for sub in item.subitems:
- subitems.append(
- ItemStatus(sub.name, pypy_exists=pypy_exists and pypy_items[item].subitems and sub in pypy_items[item].subitems)
+ all_items.append(
+ ItemStatus(item.name + "." + sub.name, pypy_exists=pypy_exists and pypy_items[item].subitems and sub in pypy_items[item].subitems)
)
- subitems = sorted(subitems)
- all_items.append(
- ItemStatus(item.name, pypy_exists=item in pypy_items, subitems=subitems)
- )
-
- html = jinja2.Template(PAGE_TEMPLATE).render(all_items=sorted(all_items))
+ all_items.append(ItemStatus(item.name, pypy_exists=item in pypy_items))
+ html = jinja2.Template(PAGE_TEMPLATE).render(all_items=split(sorted(all_items)), msg=msg)
with tempfile.NamedTemporaryFile(delete=False) as f:
f.write(html.encode("utf-8"))
webbrowser.open_new_tab(f.name)
if __name__ == '__main__':
- main(sys.argv)
\ No newline at end of file
+ main(sys.argv)
More information about the pypy-commit
mailing list