summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2018-07-13 00:06:43 +0200
committerMichał Górny <mgorny@gentoo.org>2018-07-13 00:25:59 +0200
commit9e75380f3945567172af1e2487ce4d1d1aeae81f (patch)
tree607ab872146458ffdbc23ba42103752d848962c4 /dev-python/pygments
parentdev-python/denonavr: remove old (diff)
downloadgentoo-9e75380f3945567172af1e2487ce4d1d1aeae81f.tar.gz
gentoo-9e75380f3945567172af1e2487ce4d1d1aeae81f.tar.bz2
gentoo-9e75380f3945567172af1e2487ce4d1d1aeae81f.zip
dev-python/pygments: Backport python3.7 generator fix
Diffstat (limited to 'dev-python/pygments')
-rw-r--r--dev-python/pygments/files/pygments-2.2.0-pep479.patch46
-rw-r--r--dev-python/pygments/pygments-2.2.0.ebuild5
2 files changed, 51 insertions, 0 deletions
diff --git a/dev-python/pygments/files/pygments-2.2.0-pep479.patch b/dev-python/pygments/files/pygments-2.2.0-pep479.patch
new file mode 100644
index 000000000000..28d40e9566a2
--- /dev/null
+++ b/dev-python/pygments/files/pygments-2.2.0-pep479.patch
@@ -0,0 +1,46 @@
+# HG changeset patch
+# User Miro Hrončok <miro@hroncok.cz>
+# Date 1530720528 -7200
+# Branch py37
+# Node ID 933b5f6afe35e6d554f46085a4e62dc5bf413c87
+# Parent 7941677dc77d4f2bf0bbd6140ade85a9454b8b80
+PEP 479: Raising StopIteration from a generator is now an error
+
+So we return instead. Fix needed for Python 3.7.
+
+Fixes https://bitbucket.org/birkenfeld/pygments-main/issues/1457
+
+diff --git a/pygments/lexers/lisp.py b/pygments/lexers/lisp.py
+--- a/pygments/lexers/lisp.py
++++ b/pygments/lexers/lisp.py
+@@ -2327,13 +2327,13 @@
+ token = Name.Function if token == Literal else token
+ yield index, token, value
+
+- raise StopIteration
++ return
+
+ def _process_signature(self, tokens):
+ for index, token, value in tokens:
+ if token == Literal and value == '}':
+ yield index, Punctuation, value
+- raise StopIteration
++ return
+ elif token in (Literal, Name.Function):
+ token = Name.Variable if value.istitle() else Keyword.Type
+ yield index, token, value
+diff --git a/pygments/lexers/sql.py b/pygments/lexers/sql.py
+--- a/pygments/lexers/sql.py
++++ b/pygments/lexers/sql.py
+@@ -347,7 +347,10 @@
+ # Emit the output lines
+ out_token = Generic.Output
+ while 1:
+- line = next(lines)
++ try:
++ line = next(lines)
++ except StopIteration:
++ return
+ mprompt = re_prompt.match(line)
+ if mprompt is not None:
+ # push the line back to have it processed by the prompt
diff --git a/dev-python/pygments/pygments-2.2.0.ebuild b/dev-python/pygments/pygments-2.2.0.ebuild
index 07dcfb618418..d9da923f8cdf 100644
--- a/dev-python/pygments/pygments-2.2.0.ebuild
+++ b/dev-python/pygments/pygments-2.2.0.ebuild
@@ -32,6 +32,11 @@ DEPEND="${RDEPEND}
S="${WORKDIR}/${MY_P}"
+PATCHES=(
+ # fix generators for python3.7+
+ "${FILESDIR}"/pygments-2.2.0-pep479.patch
+)
+
python_compile_all() {
use doc && emake -C doc html
}