[med-svn] r1978 - in trunk/community: infrastructure/scripts website

tille at alioth.debian.org tille at alioth.debian.org
Fri Jun 6 07:00:36 UTC 2008


Author: tille
Date: 2008-06-06 07:00:34 +0000 (Fri, 06 Jun 2008)
New Revision: 1978

Removed:
   trunk/community/infrastructure/scripts/update-tasks_using_Tools
Modified:
   trunk/community/infrastructure/scripts/cddtasktools.py
   trunk/community/infrastructure/scripts/update-tasks
   trunk/community/website/tasks.tmpl
   trunk/community/website/tasks_idx.tmpl
Log:
Get rid of all fixed Debian-Med strings in the template to make it usable for other CDDs.  Note: This breaks current i18n strings but the request from others was strong enough to go for this quick and dirty solution.  I'm lacking the skill to correctly wrap Template and PHP i18n.  The rewrite of the task generating pages with better i18n is in progress...


Modified: trunk/community/infrastructure/scripts/cddtasktools.py
===================================================================
--- trunk/community/infrastructure/scripts/cddtasktools.py	2008-06-06 00:07:02 UTC (rev 1977)
+++ trunk/community/infrastructure/scripts/cddtasktools.py	2008-06-06 07:00:34 UTC (rev 1978)
@@ -445,7 +445,7 @@
                     continue
                 # The following keys will be mostly used for programs that
                 # are not yet existing in Debian and will go to our todo list
-                if key == 'Homepage':
+                if key == 'homepage':
                     if dep != None:
                         dep.homepage = stanza['homepage']
                     else:

Modified: trunk/community/infrastructure/scripts/update-tasks
===================================================================
--- trunk/community/infrastructure/scripts/update-tasks	2008-06-06 00:07:02 UTC (rev 1977)
+++ trunk/community/infrastructure/scripts/update-tasks	2008-06-06 07:00:34 UTC (rev 1978)
@@ -31,6 +31,21 @@
               'debian-junior'  : HTMLBASE+"/cdd/htdocs/junior/tasks/",
               'debian-science' : HTMLBASE+"/cdd/htdocs/science/tasks/",
             }
+
+PRINTEDNAME={ 'debian-med'     : "Debian Med",
+              'debian-edu'     : "Debian Edu",
+              'debian-gis'     : "Debian GIS",
+              'debian-junior'  : "Debian Junior",
+              'debian-science' : "Debian Science",
+            }
+
+EMAILLIST = { 'debian-med'     : "debian-med at lists.debian.org",
+              'debian-edu'     : "debian-edu at lists.debian.org",
+              'debian-gis'     : "pkg-grass-general at lists.alioth.debian.org",
+              'debian-junior'  : "debian-junior at lists.debian.org",
+              'debian-science' : "debian-science at lists.debian.org",
+            }
+
 TEMPLATEDIR = "/var/lib/gforge/chroot/home/groups/debian-med/htdocs/"
 
 ###
@@ -54,6 +69,7 @@
 	node.tasks.repeat(renderTaskList, tasks)
 	t = datetime.now()
 	node.date.content = formatdate(time.mktime(t.timetuple()))
+	node.CDD.content  = CDD
 
 def renderTaskList(node, task):
 	node.task.raw = """<a href="%s.php" name="%s" id="%s">%s</a>""" % (task, task, task, task.capitalize())
@@ -61,6 +77,8 @@
 def renderTasks(node, task, packages, details):
 	global cdeps
 	
+	node.CDD.content = PRINTEDNAME[CDD]
+        node.CDDmail.content = '<a href="mailto:%s">%s mailing list</a>' % (EMAILLIST[CDD], PRINTEDNAME[CDD])
 	node.task.content = details['Task']
 	node.shortdesc.content = details['ShortDesc']
 	node.heading.content = details['ShortDesc']

Deleted: trunk/community/infrastructure/scripts/update-tasks_using_Tools
===================================================================
--- trunk/community/infrastructure/scripts/update-tasks_using_Tools	2008-06-06 00:07:02 UTC (rev 1977)
+++ trunk/community/infrastructure/scripts/update-tasks_using_Tools	2008-06-06 07:00:34 UTC (rev 1978)
@@ -1,319 +0,0 @@
-#!/usr/bin/python -W ignore
-
-#
-# This Python script is:
-#  (C) 2007, David Paleino <d.paleino at gmail.com>
-#
-# It is licensed under the terms of GNU General Public License (GPL)
-# v3, or any later revision.
-#
-
-import apt
-import apt_pkg
-import apt_inst
-import HTMLTemplate
-import re
-import sys
-import time
-from datetime import datetime
-from email.Utils import formatdate
-from Tools import *
-
-base = "/var/lib/gforge/chroot/home/groups/debian-med"
-tasks = "%s/scripts/tasks" % base
-
-official = {}	# Official packages
-todo = {}		# Packages not in repositories, nor unofficial,
-				# nor prospected. They will eventually go into
-				# "unavailable".
-det = {}		# Official Packages details
-
-# let's get our nice dict in the form:
-# { 'task_foo': ['package1', 'package2', '...'],
-#   'task_bar': ['package3', 'package4', '...']}
-
-packages = parseTasks(None, True)
-unofficial = parseTasksNonOff()
-unavailable = parseTasksUnavail()
-task_details = parseTaskDetails()
-
-tasks = packages.keys()
-tasks.sort()
-
-apt_pkg.init()
-#~ apt_pkg.Config.Set("APT::Acquire::Translation", "it")
-
-cache = apt_pkg.GetCache()
-depcache = apt_pkg.GetDepCache(cache)
-aptcache = apt.Cache()
-
-###
-# Wrappers around apt_pkg
-###
-
-def __getRecords(package):
-	### TODO: convert to Python API
-	(f, index) = depcache.GetCandidateVer(cache[package]).TranslatedDescription.FileList.pop(0)
-	records = apt_pkg.GetPkgRecords(cache)
-	records.Lookup ((f, index))
-	return records
-
-def __getDesc(package):
-	regex = r"""(?P<short>.*)
-(?P<long>(^ .*$\n)+\n?)"""
-
-	p = re.compile(regex, re.MULTILINE)
-	m = p.match(getSections(package)['Description'])
-	if m:
-		return {'ShortDesc': m.group("short"), 'LongDesc': m.group("long")}
-	else:
-		return False
-
-def getShort(package):
-	### TODO: convert to Python API
-	desc = __getDesc(package)
-	if desc:
-		return desc['ShortDesc']
-	else:
-		# Fallback to the C++ wrapper
-		return __getRecords(package).ShortDesc
-
-def getLong(package):
-	### TODO: convert to Python API
-	desc = __getDesc(package)
-	if desc:
-		return desc['LongDesc']
-	else:
-		# Fallback to the C++ wrapper
-		return __getRecords(package).LongDesc
-
-def getHomepage(package):
-	sect = getSections(package)
-	try:
-		return sect['Homepage']
-	# Fallback to the old "  Homepage: ..." pseudo-field
-	# TODO: also renders _wrong_ "URL" pseudo-fields! Fix the packages!
-	except:
-		p = re.compile(".*(?P<field>Homepage|URL): (?P<url>.*)", re.DOTALL)
-		m = p.match(getLong(package))
-		if m:
-			tmp = det[package]['LongDesc']
-			det[package]['LongDesc'] = tmp.replace(m.group("field") + ": " + m.group("url"), "")
-			return m.group("url")
-		else:
-			# We don't have any valid field for homepage,
-			# return a suitable "#" for <a href>s.
-			return "#"
-
-def getDebUrl(package):
-	try:
-		return getSections(package)["Filename"]
-	except:
-		return "#"
-
-def getVersion(package):
-	try:
-		return getSections(package)["Version"]
-	except:
-		# Fallback to the C++ wrapper
-		for pkg in cache.Packages:
-			if pkg.Name in det:
-				if not pkg.VersionList:
-					return "N/A"
-				else:
-					return pkg.VersionList[0].VerStr
-
-def getLicense(package):
-	### FIX
-	return "GPL-foo"
-
-def getSections(package):
-	pkg = aptcache[package]
-	pkg._lookupRecord(True)
-	return apt_pkg.ParseSection(pkg._records.Record)
-
-###
-# Template handlers
-###
-
-def renderIndex(node, tasks):
-	node.tasks.repeat(renderTaskList, tasks)
-	t = datetime.now()
-	node.date.content = formatdate(time.mktime(t.timetuple()))
-
-def renderTaskList(node, task):
-	node.task.raw = """<a href="/tasks/%s.php" name="%s" id="%s">%s</a>""" % (task, task, task, task.capitalize())
-
-def renderTasks(node, task, packages, details):
-	node.task.content = details['Task']
-	node.shortdesc.content = details['ShortDesc']
-	node.heading.content = details['ShortDesc']
-	node.longdesc.content = details['LongDesc']
-
-	t = datetime.now()
-	node.date.content = formatdate(time.mktime(t.timetuple()))
-
-	# Let's separate official packages from others
-	for pkg in packages:
-		# If the package has a short description in cache,
-		# there's an high chance it is an official package.
-		# Probably we can use a better algorithm? (I believe
-		# Alioth's APT cache won't be contaminated by external
-		# repositories)
-		try:
-			short = getShort(pkg)
-			if not task in official:
-				official[task] = []
-			official[task].append(pkg)
-			det[pkg] = {}
-			det[pkg]['ShortDesc'] = short
-			det[pkg]['LongDesc'] = getLong(pkg).replace("%s\n" % short, "")
-			det[pkg]['LongDesc'] = det[pkg]['LongDesc'].replace("<", "&lt;").replace(">", "&gt;")
-			# getHomepage() does some magic on ['LongDesc']
-			det[pkg]['Homepage'] = getHomepage(pkg)
-			det[pkg]['LongDesc'] = det[pkg]['LongDesc'].replace("\n .\n", "<br /><br />").replace("\n", "")
-			det[pkg]['Version'] = getVersion(pkg)
-			det[pkg]['License'] = getLicense(pkg)
-			det[pkg]['Task'] = task
-			det[pkg]['Pkg-URL'] = "http://packages.debian.org/unstable/%s/%s" % (getSections(pkg)['Section'], pkg)
-			### BUG: some packages don't get the right Filename
-			###      see, for example, "treeviewx": it has a Filename
-			###      field, but doesn't get parsed.
-			### FIX: installed packages with versions newer than the
-			###      one in repositories don't have that field. :@!
-			det[pkg]['Deb-URL'] = "http://ftp.debian.org/%s" % getDebUrl(pkg)
-		except:
-			pass
-
-	if task in official:
-		node.official_head.raw = """<h2>
-<a id="official-debs" name="official-debs"></a>
-	Official Debian packages
-</h2>"""
-		node.official.repeat(renderOfficial, official[task], task)
-
-	if task in todo:
-		error = True
-	else:
-		error = False
-
-	if task in unofficial:
-		node.unofficial_head.raw = """<h2>
-<a id="inofficial-debs" name="inofficial-debs"></a>
-	Inofficial Debian packages
-</h2>"""
-		node.unofficial.repeat(renderUnofficial, unofficial[task])
-		error = False
-
-	if task in unavailable:
-		node.unavailable_head.raw = """<h2>
-<a id="debs-not-available" name="debs-not-available"></a>
-	Debian packages not available
-</h2>"""
-		node.unavailable.repeat(renderUnavailable, unavailable[task])
-		error = False
-
-	if error:
-		# The package probably needs a proper prospective entry in the
-		# task files. Write it to stdout.
-		print "Error: problems with %s" % task
-
-def renderOfficial(node, package, task):
-	# Here we parse just official packages
-	node.shortdesc.content = det[package]['ShortDesc']
-	node.project.raw = "<table class=\"project\" summary=\"%s\">" % package
-	node.anchor.atts['name'] = package
-	node.anchor.atts['id'] = package
-	node.name.content = package.capitalize()
-	node.url.atts['href'] = det[package]['Homepage']
-	if det[package]['Homepage'] == "#":
-		node.url.content = "Homepage not available"
-	else:
-		node.url.content = det[package]['Homepage']
-
-	node.longdesc.raw = det[package]['LongDesc']
-	node.version.content = "Version: %s" % det[package]['Version']
-	node.license.content = "License: %s" % det[package]['License']
-	node.pkgurl.atts['href'] = det[package]['Pkg-URL']
-	node.pkgurl.content = "Official Debian package"
-	node.deburl.atts['href'] = det[package]['Deb-URL']
-	#~ node.deburl.content = "X" ### TODO: add a nice icon here to download the .deb package
-	node.deburl.raw = "<img src=\"/img/deb-icon.png\" />"
-
-def renderUnofficial(node, package):
-	# Here we parse just unofficial packages
-	node.shortdesc.content = package['ShortDesc']
-	node.longdesc.raw = package['LongDesc']
-	node.project.raw = "<table class=\"project\" summary=\"%s\">" % package['Package']
-	node.anchor.atts['name'] = package['Package']
-	node.anchor.atts['id'] = package['Package']
-	node.name.content = package['Package'].capitalize()
-	node.url.atts['href'] = package['Homepage']
-	node.url.content = package['Homepage']
-	node.license.content = "License: %s" %package['License']
-	node.pkgurl.atts['href'] = package['Pkg-URL']
-	node.pkgurl.content = "Inofficial Debian package"
-
-	# Let's try to get the version from the package name
-	# (following Debian standards: <name>_<ver>_<arch>.deb)
-	regex = ".*/%s_(?P<version>.*)_.*\.deb$" % package['Package']
-	p = re.compile(regex)
-	m = p.search(package['Pkg-URL'])
-	if m:
-		node.version.content = "Version: %s" % m.group("version")
-	else:
-		node.version.content = "Version: N/A"
-
-
-def renderUnavailable(node, package):
-	# Parsing unavailable packages :(
-	# PACKAGE THEM! :)
-	name = package['Package']
-	if package['ShortDesc']:
-		node.shortdesc.content = package['ShortDesc']
-	else:
-		node.shortdesc.content = "N/A"
-	node.longdesc.raw = package['LongDesc']
-	node.project.raw = "<table class=\"project\" summary=\"%s\">" % name
-	if package['Responsible']:
-		node.responsible.content = package['Responsible']
-	else:
-		node.responsible.raw = "no one"
-	if package['WNPP']:
-		node.wnpp.raw = " &mdash; <a href=\"http://bugs.debian.org/%s\">wnpp</a>" % package['WNPP']
-	node.anchor.atts['name'] = name
-	node.anchor.atts['id'] = name
-	node.name.content = name.capitalize()
-	if package['Homepage']:
-		node.url.atts['href'] = package['Homepage']
-		node.url.content = package['Homepage']
-	else:
-		node.url.atts['href'] = "#"
-		node.url.content = "N/A"
-	if package['License']:
-		node.license.raw = "<?=_('License')?>: %s" % package['License']
-	else:
-		node.license.raw = "<?=_('License')?>: N/A"
-
-# Let's render the Tasks Page index, first
-f = open("%s/htdocs/tasks_idx.tmpl" % base)
-tmpl = HTMLTemplate.Template(renderIndex, f.read())
-f.close()
-f = open("%s/static/tasks/index.php" % base, "w")
-f.write(tmpl.render(tasks))
-f.close()
-
-# Let's render single pages now.
-f = open("%s/htdocs/tasks.tmpl" % base)
-tmpl = HTMLTemplate.Template(renderTasks, f.read())
-f.close()
-
-for task in tasks:
-	f = open("%s/static/tasks/%s.php" % (base, task), "w")
-
-	# This is to avoid useless <br>eaks before closing the cell
-	source = tmpl.render(task, packages[task], task_details[task])
-	f.write(re.sub(r"<br /><br />[ ]*</td>", "</td>", source))
-
-	f.close()
-

Modified: trunk/community/website/tasks.tmpl
===================================================================
--- trunk/community/website/tasks.tmpl	2008-06-06 00:07:02 UTC (rev 1977)
+++ trunk/community/website/tasks.tmpl	2008-06-06 07:00:34 UTC (rev 1978)
@@ -15,9 +15,10 @@
 			</div>
 			<div class="row">
 				<p>
-					<?=_("The list to the right includes various software projects which are of some interest to the Debian-Med Project.")?>
+					<?=_("The list to the right includes various software projects which are of some interest for")?> <em node="con:CDD"></em>.
 					<?=_("Currently, only a few of them are available as Debian packages.")?>
-					<?=_("It is our goal, however, to include all software in Debian-Med which can sensibly add to a high quality Custom Debian Distribution.")?>
+					<?=_("It is our goal, however, to include all software in")?> <em node="con:CDD"></em>
+					<?=_(" which can sensibly add to a high quality Custom Debian Distribution.")?>
 				</p>
 				<p>
 					<?=_("For a better overview of the project's availability as a Debian package, each head row has a color code according to this scheme:")?>
@@ -28,10 +29,9 @@
 					<li><?= sprintf(_("Red: The project is %snot (yet) available as a Debian package%s"), '<a href="#debs-not-available">', '</a>'); ?></li>
 				</ul>
 				<p>
-					<?= sprintf(_("If you discover a project which looks like a good candidate for Debian-Med to you, " .
-						"or if you have prepared an inofficial Debian package, please do not hesitate to send " .
-						"a description of that project to the %sDebian-Med mailing list%s"), '<a href="mailto:debian-med at lists.debian.org">',
-						'</a>'); ?>
+					<?=_("If you discover a project which looks like a good candidate for")?> <em node="con:CDD"></em> 
+					<?=_("to you, or if you have prepared an inofficial Debian package, please do not hesitate to send a description of that project to the")?> 
+					<em node="con:CDDmail"></em>.
 				</p>
 			</div>
 		</div>
@@ -110,7 +110,6 @@
 </tr>
 </table>
 <address><?=_("Last update")?>: <div node="-con:date"></div></address>
-<address><?=_("Please note: this page gets automatically updated twice a day, on 00:00 and 12:00 UTC.")?></address>
 <?php
 require_once("inc/footer.inc.php");
 ?>

Modified: trunk/community/website/tasks_idx.tmpl
===================================================================
--- trunk/community/website/tasks_idx.tmpl	2008-06-06 00:07:02 UTC (rev 1977)
+++ trunk/community/website/tasks_idx.tmpl	2008-06-06 07:00:34 UTC (rev 1978)
@@ -17,7 +17,7 @@
 		<div class="pageBody">
 			<h1><?=_("Tasks page")?></h1>
 			<p>
-				This is a list of the Tasks Debian-Med is made of:
+				This is a list of the Tasks <span node="con:CDD"></span> is made of:
 			</p>
 			<ul>
 				<div node="-rep:tasks"><li><p node="-con:task"></p></li></div>
@@ -27,7 +27,6 @@
 </tr>
 </table>
 <address><?=_("Last update")?>: <div node="-con:date"></div></address>
-<address><?=_("Please note: this page gets automatically updated twice a day, on 00:00 and 12:00 UTC.")?></address>
 <?php
 require_once("inc/footer.inc.php");
 ?>




More information about the debian-med-commit mailing list