[kernel] r14407 - dists/trunk/firmware-nonfree/debian/bin
Ben Hutchings
benh at alioth.debian.org
Sun Oct 18 18:33:51 UTC 2009
Author: benh
Date: Sun Oct 18 18:33:49 2009
New Revision: 14407
Log:
Override Gencontrol.substitute() to support optional variables.
If there is a '?' before the name in a template variable reference and
the variable is undefined, substitute an empty string rather than
raising an exception.
Modified:
dists/trunk/firmware-nonfree/debian/bin/gencontrol.py
Modified: dists/trunk/firmware-nonfree/debian/bin/gencontrol.py
==============================================================================
--- dists/trunk/firmware-nonfree/debian/bin/gencontrol.py Sun Oct 18 18:28:56 2009 (r14406)
+++ dists/trunk/firmware-nonfree/debian/bin/gencontrol.py Sun Oct 18 18:33:49 2009 (r14407)
@@ -286,6 +286,16 @@
entries.append(self.process_template(i, vars))
return entries
+ def substitute(self, s, vars):
+ if isinstance(s, (list, tuple)):
+ return [self.substitute(i, vars) for i in s]
+ def subst(match):
+ if match.group(1):
+ return vars.get(match.group(2), '')
+ else:
+ return vars[match.group(2)]
+ return re.sub(r'@(\??)([-_a-z]+)@', subst, s)
+
def write(self, packages, makefile):
self.write_control(packages.itervalues())
self.write_makefile(makefile)
More information about the Kernel-svn-changes
mailing list