From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1035912-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 601C3138334
	for <garchives@archives.gentoo.org>; Thu, 12 Jul 2018 22:26:10 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 2601EE093D;
	Thu, 12 Jul 2018 22:26:09 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id E042DE093D
	for <gentoo-commits@lists.gentoo.org>; Thu, 12 Jul 2018 22:26:08 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id ECBAE335D4C
	for <gentoo-commits@lists.gentoo.org>; Thu, 12 Jul 2018 22:26:06 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 76E4E349
	for <gentoo-commits@lists.gentoo.org>; Thu, 12 Jul 2018 22:26:04 +0000 (UTC)
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" <mgorny@gentoo.org>
Message-ID: <1531434359.9e75380f3945567172af1e2487ce4d1d1aeae81f.mgorny@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/pygments/files/, dev-python/pygments/
X-VCS-Repository: repo/gentoo
X-VCS-Files: dev-python/pygments/files/pygments-2.2.0-pep479.patch dev-python/pygments/pygments-2.2.0.ebuild
X-VCS-Directories: dev-python/pygments/ dev-python/pygments/files/
X-VCS-Committer: mgorny
X-VCS-Committer-Name: Michał Górny
X-VCS-Revision: 9e75380f3945567172af1e2487ce4d1d1aeae81f
X-VCS-Branch: master
Date: Thu, 12 Jul 2018 22:26:04 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 2c520a8d-eaa0-43d8-8c56-65faa9e47692
X-Archives-Hash: 61c31af4ad52302a317bbdf61bc6e64a

commit:     9e75380f3945567172af1e2487ce4d1d1aeae81f
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 12 22:06:43 2018 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Jul 12 22:25:59 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9e75380f

dev-python/pygments: Backport python3.7 generator fix

 .../pygments/files/pygments-2.2.0-pep479.patch     | 46 ++++++++++++++++++++++
 dev-python/pygments/pygments-2.2.0.ebuild          |  5 +++
 2 files changed, 51 insertions(+)

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 00000000000..28d40e9566a
--- /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 07dcfb61841..d9da923f8cd 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
 }