commit:     03b5427fc413811739b001b299fda1d3cc02228a
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Jun  9 18:47:37 2020 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Wed Jun 10 07:31:49 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03b5427f

dev-python/jupyter_console: Port to py3.9

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../files/jupyter_console-6.1.0-py39.patch         | 51 ++++++++++++++++++++++
 .../jupyter_console/jupyter_console-6.1.0.ebuild   |  6 ++-
 2 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/dev-python/jupyter_console/files/jupyter_console-6.1.0-py39.patch 
b/dev-python/jupyter_console/files/jupyter_console-6.1.0-py39.patch
new file mode 100644
index 00000000000..92d3532649e
--- /dev/null
+++ b/dev-python/jupyter_console/files/jupyter_console-6.1.0-py39.patch
@@ -0,0 +1,51 @@
+From 3b648aab9ce731beab1f02d714a97905ab0e42e1 Mon Sep 17 00:00:00 2001
+From: Karthikeyan Singaravelan <[email protected]>
+Date: Thu, 2 Jan 2020 18:30:41 +0530
+Subject: [PATCH] Fix deprecation warning in base64
+
+---
+ jupyter_console/ptshell.py                  | 6 +++---
+ jupyter_console/tests/test_image_handler.py | 2 +-
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/jupyter_console/ptshell.py b/jupyter_console/ptshell.py
+index 84af32f..6a55fe1 100644
+--- a/jupyter_console/ptshell.py
++++ b/jupyter_console/ptshell.py
+@@ -818,12 +818,12 @@ def handle_image_PIL(self, data, mime):
+             from PIL import Image, ImageShow
+         except ImportError:
+             return False
+-        raw = base64.decodestring(data[mime].encode('ascii'))
++        raw = base64.decodebytes(data[mime].encode('ascii'))
+         img = Image.open(BytesIO(raw))
+         return ImageShow.show(img)
+ 
+     def handle_image_stream(self, data, mime):
+-        raw = base64.decodestring(data[mime].encode('ascii'))
++        raw = base64.decodebytes(data[mime].encode('ascii'))
+         imageformat = self._imagemime[mime]
+         fmt = dict(format=imageformat)
+         args = [s.format(**fmt) for s in self.stream_image_handler]
+@@ -835,7 +835,7 @@ def handle_image_stream(self, data, mime):
+         return (proc.returncode == 0)
+ 
+     def handle_image_tempfile(self, data, mime):
+-        raw = base64.decodestring(data[mime].encode('ascii'))
++        raw = base64.decodebytes(data[mime].encode('ascii'))
+         imageformat = self._imagemime[mime]
+         filename = 'tmp.{0}'.format(imageformat)
+         with NamedFileInTemporaryDirectory(filename) as f, \
+diff --git a/jupyter_console/tests/test_image_handler.py 
b/jupyter_console/tests/test_image_handler.py
+index 5296635..b2a5ea9 100644
+--- a/jupyter_console/tests/test_image_handler.py
++++ b/jupyter_console/tests/test_image_handler.py
+@@ -32,7 +32,7 @@ def setUp(self):
+         self.shell = NonCommunicatingShell()
+         self.raw = b'dummy data'
+         self.mime = 'image/png'
+-        self.data = {self.mime: base64.encodestring(self.raw).decode('ascii')}
++        self.data = {self.mime: base64.encodebytes(self.raw).decode('ascii')}
+ 
+     def test_call_pil_by_default(self):
+         pil_called_with = []

diff --git a/dev-python/jupyter_console/jupyter_console-6.1.0.ebuild 
b/dev-python/jupyter_console/jupyter_console-6.1.0.ebuild
index d113b9fecd9..37b6ca896bc 100644
--- a/dev-python/jupyter_console/jupyter_console-6.1.0.ebuild
+++ b/dev-python/jupyter_console/jupyter_console-6.1.0.ebuild
@@ -3,7 +3,7 @@
 
 EAPI=7
 
-PYTHON_COMPAT=( python3_{6,7} )
+PYTHON_COMPAT=( python3_{6..9} )
 
 inherit distutils-r1
 
@@ -33,6 +33,10 @@ BDEPEND="
 distutils_enable_sphinx docs
 distutils_enable_tests nose
 
+PATCHES=(
+       "${FILESDIR}"/${P}-py39.patch
+)
+
 python_test() {
        script -eqc "nosetests -v" || die
 }

Reply via email to