[python-debian/master] changelog: add iterator over changelog blocks
Filippo Giunchedi
filippo at esaurito.net
Thu Sep 3 12:36:47 UTC 2009
Also add a basic test for the returned iterator
Closes: #539334
---
debian/changelog | 5 ++++-
debian_bundle/changelog.py | 7 +++++++
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index eaf743a..1700a35 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,7 +14,10 @@ python-debian (0.1.15) UNRELEASED; urgency=low
* make debian_support.Version hashable, patch from Piotr Ożarowski
(Closes: #543223)
- -- John Wright <jsw at debian.org> Thu, 30 Jul 2009 01:03:49 +0200
+ [ Filippo Giunchedi ]
+ * changelog: add iterator over changelog blocks (Closes: #539334)
+
+ -- Filippo Giunchedi <filippo at debian.org> Sun, 09 Aug 2009 12:35:00 +0100
python-debian (0.1.14) unstable; urgency=low
diff --git a/debian_bundle/changelog.py b/debian_bundle/changelog.py
index ae72a90..60398ad 100644
--- a/debian_bundle/changelog.py
+++ b/debian_bundle/changelog.py
@@ -495,6 +495,9 @@ class Changelog(object):
cl += str(block)
return cl
+ def __iter__(self):
+ return iter(self._blocks)
+
def set_distributions(self, distributions):
self._blocks[0].distributions = distributions
distributions = property(lambda self: self._blocks[0].distributions,
@@ -658,6 +661,10 @@ class ChangelogTests(unittest.TestCase):
for c in (c1, c2, c3):
self.assertEqual(str(c), cl_data)
+ def test_block_iterator(self):
+ c = Changelog(open('test_changelog'))
+ self.assertEqual(map(str, c._blocks), map(str, c))
+
class VersionTests(unittest.TestCase):
def _test_version(self, full_version, epoch, upstream, debian):
--
1.5.6.5
More information about the pkg-python-debian-commits
mailing list