summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-06-09 20:47:37 +0200
committerMichał Górny <mgorny@gentoo.org>2020-06-10 09:31:49 +0200
commit03b5427fc413811739b001b299fda1d3cc02228a (patch)
treecab5db06ed16105aec03880b31694c90b7861231 /dev-python/jupyter_console
parentdev-python/qtconsole: Port to py3.9 (diff)
downloadgentoo-03b5427fc413811739b001b299fda1d3cc02228a.tar.gz
gentoo-03b5427fc413811739b001b299fda1d3cc02228a.tar.bz2
gentoo-03b5427fc413811739b001b299fda1d3cc02228a.zip
dev-python/jupyter_console: Port to py3.9
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/jupyter_console')
-rw-r--r--dev-python/jupyter_console/files/jupyter_console-6.1.0-py39.patch51
-rw-r--r--dev-python/jupyter_console/jupyter_console-6.1.0.ebuild6
2 files changed, 56 insertions, 1 deletions
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 000000000000..92d3532649e9
--- /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 <tir.karthi@gmail.com>
+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 d113b9fecd96..37b6ca896bc2 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
}