[Pkg-ocaml-maint-commits] r3979 - in /trunk/tools/ocaml-debian-status: ./ debian-ocaml-status.genshi debian-ocaml-status.py ocaml-status.css
zack at users.alioth.debian.org
zack at users.alioth.debian.org
Thu Jul 12 09:19:42 UTC 2007
Author: zack
Date: Thu Jul 12 09:19:41 2007
New Revision: 3979
URL: http://svn.debian.org/wsvn/?sc=1&rev=3979
Log:
added html rendering with bells and whistles
Added:
trunk/tools/ocaml-debian-status/debian-ocaml-status.genshi
trunk/tools/ocaml-debian-status/ocaml-status.css
Modified:
trunk/tools/ocaml-debian-status/ (props changed)
trunk/tools/ocaml-debian-status/debian-ocaml-status.py
Propchange: trunk/tools/ocaml-debian-status/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Thu Jul 12 09:19:41 2007
@@ -1,0 +1,2 @@
+data
+*.html
Added: trunk/tools/ocaml-debian-status/debian-ocaml-status.genshi
URL: http://svn.debian.org/wsvn/trunk/tools/ocaml-debian-status/debian-ocaml-status.genshi?rev=3979&op=file
==============================================================================
--- trunk/tools/ocaml-debian-status/debian-ocaml-status.genshi (added)
+++ trunk/tools/ocaml-debian-status/debian-ocaml-status.genshi Thu Jul 12 09:19:41 2007
@@ -1,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?xml-stylesheet type="text/css" href="ocaml-status.css" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:py="http://genshi.edgewall.org/"
+ xml:lang="en" >
+ <head>
+ <link type="text/css" rel="stylesheet" href="ocaml-status.css" />
+ <title>OCaml Packages Status in Debian</title>
+ </head>
+ <body>
+
+ <h1>Status of OCaml in Debian</h1>
+
+ <h2>Packages</h2>
+
+ <div class="legend">
+ <p>
+ Legend:
+ <span class="inTesting">in testing</span>,
+ <span class="inUnstable">in unstable</span>,
+ <span class="inExperimental">in experimental</span>.
+ </p>
+ </div>
+
+ <div class="status">
+ <table>
+ <thead>
+ <tr>
+ <th>Package</th>
+ <th py:for="version in ocaml_versions">
+ OCaml <span class="version" py:content="version">x.y.z</span>
+ </th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr py:for="(src, ocaml_versions) in packages">
+ <td>
+ <a href="http://packages.qa.debian.org/${src}"><span
+ class="package" py:content="src">pkg</span></a>
+ </td>
+ <td py:for="versions in ocaml_versions" py:choose="">
+ <span py:when="versions is None"></span>
+ <span py:when="versions.has_key('testing')" class="inTesting"
+ py:content="versions['testing']">
+ (testing) x.y.z
+ </span>
+ <span py:when="versions.has_key('unstable')" class="inUnstable"
+ py:content="versions['unstable']">
+ (unstable) x.y.z
+ </span>
+ <span py:when="versions.has_key('experimental')"
+ class="inExperimental"
+ py:content="versions['experimental']">
+ (experimental) x.y.z
+ </span>
+ <span py:otherwise="">(?)</span>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <div id="footer">
+ <p> Last generated: <span class="timestamp"
+ py:content="str(timestamp)">year/month/day ...</span> <br />
+ Contact: <a href="mailto:zack at debian.org">Stefano Zacchiroli</a> ; the
+ code which generates this page <a
+ href="http://svn.debian.org/wsvn/pkg-ocaml-maint/trunk/tools/ocaml-debian-status/?rev=0&sc=0">is
+ available</a>. <br /> Kudos: fpeters and his <a
+ href="http://www.0d.be/debian/debian-gnome-2.14-status.html">Gnome
+ Status Page</a>, from which I shamelessly copied this page idea (and
+ CSS). </p>
+ </div>
+
+ </body>
+</html>
Modified: trunk/tools/ocaml-debian-status/debian-ocaml-status.py
URL: http://svn.debian.org/wsvn/trunk/tools/ocaml-debian-status/debian-ocaml-status.py?rev=3979&op=diff
==============================================================================
--- trunk/tools/ocaml-debian-status/debian-ocaml-status.py (original)
+++ trunk/tools/ocaml-debian-status/debian-ocaml-status.py Thu Jul 12 09:19:41 2007
@@ -11,12 +11,15 @@
# version.
import bz2
+import datetime
import gzip
import os
import re
import string
import sys
+
from debian_bundle import debian_support
+from genshi.template import TemplateLoader
ocaml_dep_RE = re.compile(r'\bocaml(-nox)?\b')
ocaml_virtdep_RE = re.compile(r'\bocaml(-nox)?-(?P<version>\d+(\.\d+)*)\b')
@@ -69,21 +72,19 @@
packages = filter(lambda fname: re.search(r'-Packages\b', fname), files)
distro_of_fname = lambda fname: os.path.basename(fname).split('-')[0]
-# STEP 1: find names of source packages we are interested in
-
+ # STEP 1: find names of source packages we are interested in
relevant_sources = set()
for fname in sources:
- print fname, '...'
f = smart_open(fname)
srcfile = debian_support.PackageFile('', fileObj=f)
relevant_sources = relevant_sources.union(set(grep_sources(srcfile)))
f.close()
-# STEP 2: classify packages
-
- # nested dictionary structure:
- # src_name -> (ocaml_version -> list of pairs (distro, src_version))
+ # STEP 2: classify packages
status = {}
+ ocaml_versions = []
+ # nested dictionary structure:
+ # src_name -> (ocaml_version -> (distro -> src_version))
for fname in packages:
print fname, '...'
f = smart_open(fname)
@@ -96,26 +97,46 @@
pkg_status = eval_status(pkg)
if pkg_status:
src_name, src_version, ocaml_version = pkg_status
+ if not ocaml_version in ocaml_versions:
+ ocaml_versions.append(ocaml_version)
if not status.has_key(src_name):
status[src_name] = {}
if not status[src_name].has_key(ocaml_version):
- status[src_name][ocaml_version] = []
- entry = (distro_of_fname(fname), src_version)
- if not entry in status[src_name][ocaml_version]:
- status[src_name][ocaml_version].append(entry)
+ status[src_name][ocaml_version] = {}
+ distro = distro_of_fname(fname)
+ status[src_name][ocaml_version][distro] = src_version
f.close()
- return status
+ return status, ocaml_versions
-# TODO
-def render_status(status):
- out = ''
+def render_status(status, domain):
+ domain.sort(debian_support.version_compare)
+
+ pkg_rows = []
for src_name in status.iterkeys():
- out += src_name + ' ' + str(status[src_name]) + '\n'
- return out
+ versions = status[src_name]
+ cells = []
+ for ocaml_version in domain:
+ if not versions.has_key(ocaml_version):
+ cells.append(None)
+ else:
+ cells.append(versions[ocaml_version])
+ pkg_rows.append((src_name, cells))
+ pkg_rows.sort(lambda (s1,c1),(s2,c2): cmp(s1, s2))
+
+ loader = TemplateLoader(['.'])
+ tmpl = loader.load('debian-ocaml-status.genshi')
+ stream = tmpl.generate(packages=pkg_rows, ocaml_versions=domain,
+ timestamp=datetime.datetime.now())
+
+ return stream
if __name__ == '__main__':
- status = ocaml_summary(sys.argv[1:])
- out = render_status(status)
- print out
+ status, domain = ocaml_summary(sys.argv[1:])
+ out = render_status(status, domain)
+ f = file('debian-ocaml-status.html', 'w')
+ f.write('<!-- GENERATED FILE, DO NOT EDIT -->\n')
+ for chunk in out.serialize():
+ f.write(chunk)
+ f.close()
Added: trunk/tools/ocaml-debian-status/ocaml-status.css
URL: http://svn.debian.org/wsvn/trunk/tools/ocaml-debian-status/ocaml-status.css?rev=3979&op=file
==============================================================================
--- trunk/tools/ocaml-debian-status/ocaml-status.css (added)
+++ trunk/tools/ocaml-debian-status/ocaml-status.css Thu Jul 12 09:19:41 2007
@@ -1,0 +1,40 @@
+body {
+ font-family: sans-serif;
+}
+h1 {
+ margin: 0;
+ padding: 5px 0px 5px 150px;
+ height: 50px;
+ background: #df0451;
+ color: white;
+ margin-bottom: 1em;
+ border-bottom: 2px solid #af0031;
+ background-image: url(http://caml.inria.fr//pub/logos/caml-inria-fr.128x58.gif);
+ background-repeat: no-repeat;
+}
+div.status {
+ text-align: center;
+}
+div#footer {
+ margin-top: 2em;
+ font-size: 60%;
+}
+
+.inTesting {
+ background: #2f2;
+}
+.inUnstable {
+ background: #8f8;
+}
+.inExperimental {
+ background: #cfc;
+}
+.version {
+}
+td {
+ border-style: solid;
+ border-width: 1px;
+}
+div.status table span {
+ display: block;
+}
More information about the Pkg-ocaml-maint-commits
mailing list