[linux] 03/17: debian_linux.{debian, utils}: Support templates for debian/tests/control
debian-kernel at lists.debian.org
debian-kernel at lists.debian.org
Sat Oct 31 22:18:15 UTC 2015
This is an automated email from the git hooks/post-receive script.
benh pushed a commit to branch master
in repository linux.
commit 5c869ad70b32001c3d3db8de13d7d49e4535472b
Author: Ben Hutchings <ben at decadent.org.uk>
Date: Tue Aug 11 23:42:35 2015 +0200
debian_linux.{debian,utils}: Support templates for debian/tests/control
---
debian/lib/python/debian_linux/debian.py | 21 +++++++++++++++++++++
debian/lib/python/debian_linux/utils.py | 6 ++++++
2 files changed, 27 insertions(+)
diff --git a/debian/lib/python/debian_linux/debian.py b/debian/lib/python/debian_linux/debian.py
index e0780ba..e59e64f 100644
--- a/debian/lib/python/debian_linux/debian.py
+++ b/debian/lib/python/debian_linux/debian.py
@@ -434,3 +434,24 @@ class Package(dict):
def values(self):
for i in self.keys():
yield self[i]
+
+
+class TestsControl(dict):
+ _fields = {
+ 'Tests': str,
+ 'Test-Command': str,
+ 'Restrictions': str,
+ 'Features': str,
+ 'Depends': PackageRelation,
+ 'Tests-Directory': str,
+ 'Classes': str,
+ }
+
+ def __setitem__(self, key, value):
+ try:
+ cls = self._fields[key]
+ if not isinstance(value, cls):
+ value = cls(value)
+ except KeyError:
+ pass
+ super(TestsControl, self).__setitem__(key, value)
diff --git a/debian/lib/python/debian_linux/utils.py b/debian/lib/python/debian_linux/utils.py
index a7d4b1d..f2fb6c3 100644
--- a/debian/lib/python/debian_linux/utils.py
+++ b/debian/lib/python/debian_linux/utils.py
@@ -26,6 +26,8 @@ class Templates(object):
f = codecs.open(filename, 'r', 'utf-8')
if prefix == 'control':
return read_control(f)
+ if prefix == 'tests-control':
+ return read_tests_control(f)
return f.read()
def get(self, key, default=None):
@@ -42,6 +44,10 @@ def read_control(f):
from .debian import Package
return _read_rfc822(f, Package)
+def read_tests_control(f):
+ from .debian import TestsControl
+ return _read_rfc822(f, TestsControl)
+
def _read_rfc822(f, cls):
entries = []
eof = False
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/kernel/linux.git
More information about the Kernel-svn-changes
mailing list