diff -Nru blockdiag-1.5.3+dfsg/debian/changelog blockdiag-1.5.3+dfsg/debian/changelog --- blockdiag-1.5.3+dfsg/debian/changelog 2017-11-15 10:44:08.000000000 +0000 +++ blockdiag-1.5.3+dfsg/debian/changelog 2018-07-16 16:07:06.000000000 +0000 @@ -1,3 +1,12 @@ +blockdiag (1.5.3+dfsg-5.2) unstable; urgency=medium + + * Non-maintainer upload. + + [ Michal Arbet ] + * Add fix-py37-breaking-changes-around-iterators.patch (Closes: 903918) + + -- Michal Arbet Mon, 16 Jul 2018 17:07:06 +0100 + blockdiag (1.5.3+dfsg-5.1) unstable; urgency=medium * Non-maintainer upload. diff -Nru blockdiag-1.5.3+dfsg/debian/patches/fix-py37-breaking-changes-around-iterators.patch blockdiag-1.5.3+dfsg/debian/patches/fix-py37-breaking-changes-around-iterators.patch --- blockdiag-1.5.3+dfsg/debian/patches/fix-py37-breaking-changes-around-iterators.patch 1970-01-01 00:00:00.000000000 +0000 +++ blockdiag-1.5.3+dfsg/debian/patches/fix-py37-breaking-changes-around-iterators.patch 2018-07-16 16:07:06.000000000 +0000 @@ -0,0 +1,74 @@ +Description: Python 3.7 compatibility + See PEP 479 for the breaking changes around iterators, based on + serhiy-storchaka's suggestions for myitertools.py changes. + Fixes #93 +Author: Dridi Boukelmoune +Date: Sun, 8 Jul 2018 17:46:06 +0200 +Origin: https://github.com/blockdiag/blockdiag/pull/94 +Last-Update: 2018-07-16 + +diff --git a/src/blockdiag/utils/myitertools.py b/src/blockdiag/utils/myitertools.py +index 364cc5c..6f7386e 100644 +--- a/src/blockdiag/utils/myitertools.py ++++ b/src/blockdiag/utils/myitertools.py +@@ -14,33 +14,40 @@ + # limitations under the License. + + from itertools import cycle ++from itertools import islice + + + def istep(seq, step=2): + iterable = iter(seq) + while True: +- yield [next(iterable) for _ in range(step)] ++ item = list(islice(iterable, step)) ++ if len(item) < step: ++ break ++ yield item + + + def stepslice(iterable, steps): +- iterable = iter(iterable) +- step = cycle(steps) ++ try: ++ iterable = iter(iterable) ++ step = cycle(steps) + +- while True: +- # skip (1) +- n = next(step) +- if n == 0: +- pass +- elif n == 1: +- o = next(iterable) +- yield o +- yield o +- else: +- yield next(iterable) +- for _ in range(n - 2): +- next(iterable) +- yield next(iterable) ++ while True: ++ # skip (1) ++ n = next(step) ++ if n == 0: ++ pass ++ elif n == 1: ++ o = next(iterable) ++ yield o ++ yield o ++ else: ++ yield next(iterable) ++ for _ in range(n - 2): ++ next(iterable) ++ yield next(iterable) + +- # skip (2) +- for _ in range(next(step)): +- next(iterable) ++ # skip (2) ++ for _ in range(next(step)): ++ next(iterable) ++ except StopIteration: ++ return diff -Nru blockdiag-1.5.3+dfsg/debian/patches/series blockdiag-1.5.3+dfsg/debian/patches/series --- blockdiag-1.5.3+dfsg/debian/patches/series 2017-11-15 10:42:59.000000000 +0000 +++ blockdiag-1.5.3+dfsg/debian/patches/series 2018-07-16 16:07:06.000000000 +0000 @@ -5,3 +5,4 @@ fixes_test_fontmap_duplicated_fontentry1.patch 848748-exception-ignored-in-Image-del.patch remove-one-assert-in-test_node_attribute.patch +fix-py37-breaking-changes-around-iterators.patch