commit:     267c5a6cdfd2d0e3839118d49598e92ac074d7b0
Author:     Austin Ray <austin <AT> austinray <DOT> io>
AuthorDate: Fri Jun 11 15:10:22 2021 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Jun 12 09:25:48 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=267c5a6c

app-misc/anki: patch Python 3.9 incompatibility

This commit modifies the existing anki-2.1.15 ebuild with a patch to
replace a deprecated, undocumented method available in Python 3.8[0] but
removed in Python 3.9[1]. Without the patch, anki throws a runtime error
(see bug for more details) as anki 2.1.15 pre-dates Python 3.9.

[0] 
https://github.com/python/cpython/blob/4844abdd700120120fc76c29d911bcb547700baf/Lib/html/parser.py#L466
[1] https://bugs.python.org/issue37328

Closes: https://bugs.gentoo.org/795309

Signed-off-by: Austin Ray <austin <AT> austinray.io>
Closes: https://github.com/gentoo/gentoo/pull/21200
Signed-off-by: Sam James <sam <AT> gentoo.org>

 app-misc/anki/{anki-2.1.15.ebuild => anki-2.1.15-r1.ebuild} |  1 +
 app-misc/anki/files/anki-2.1.15-unescape.patch              | 13 +++++++++++++
 2 files changed, 14 insertions(+)

diff --git a/app-misc/anki/anki-2.1.15.ebuild 
b/app-misc/anki/anki-2.1.15-r1.ebuild
similarity index 98%
rename from app-misc/anki/anki-2.1.15.ebuild
rename to app-misc/anki/anki-2.1.15-r1.ebuild
index a1b7dc8c2e7..f97f7bb0fbc 100644
--- a/app-misc/anki/anki-2.1.15.ebuild
+++ b/app-misc/anki/anki-2.1.15-r1.ebuild
@@ -44,6 +44,7 @@ BDEPEND="test? (
 PATCHES=(
        "${FILESDIR}"/${PN}-2.1.0_beta25-web-folder.patch
        "${FILESDIR}"/${PN}-2.1.15-mpv-args.patch
+       "${FILESDIR}"/${PN}-2.1.15-unescape.patch
 )
 
 src_prepare() {

diff --git a/app-misc/anki/files/anki-2.1.15-unescape.patch 
b/app-misc/anki/files/anki-2.1.15-unescape.patch
new file mode 100644
index 00000000000..7b03c8d8e1a
--- /dev/null
+++ b/app-misc/anki/files/anki-2.1.15-unescape.patch
@@ -0,0 +1,13 @@
+diff --git a/aqt/reviewer.py b/aqt/reviewer.py
+index f01fcbd9f..5aaf26669 100644
+--- a/aqt/reviewer.py
++++ b/aqt/reviewer.py
+@@ -359,7 +359,7 @@ Please run Tools>Empty Cards""")
+         cor = stripHTML(cor)
+         # ensure we don't chomp multiple whitespace
+         cor = cor.replace(" ", "&nbsp;")
+-        cor = parser.unescape(cor)
++        cor = html.unescape(cor)
+         cor = cor.replace("\xa0", " ")
+         cor = cor.strip()
+         given = self.typedAnswer

Reply via email to