From 0fe97ea739620ff59fc77f8bb5da8488adda8c6d Mon Sep 17 00:00:00 2001 From: Miro HronĨok Date: May 03 2020 22:20:31 +0000 Subject: Replace the Python 3.9 compatibility sed with upstream commits The inkscape test uncovered a different problem, already fixed upstream. --- diff --git a/d9a893bf60.patch b/d9a893bf60.patch new file mode 100644 index 0000000..3891bbf --- /dev/null +++ b/d9a893bf60.patch @@ -0,0 +1,21 @@ +From d9a893bf60e0e028259c953f2c9e272f0ae1b6c9 Mon Sep 17 00:00:00 2001 +From: Karthikeyan Singaravelan +Date: Sat, 22 Feb 2020 21:32:21 +0530 +Subject: [PATCH] Use encodebytes instead of encodestring in Python 3.9. + +--- + nbconvert/preprocessors/svg2pdf.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/nbconvert/preprocessors/svg2pdf.py b/nbconvert/preprocessors/svg2pdf.py +index 3a1aa22a..33514ecc 100644 +--- a/nbconvert/preprocessors/svg2pdf.py ++++ b/nbconvert/preprocessors/svg2pdf.py +@@ -123,6 +123,6 @@ def convert_figure(self, data_format, data): + if os.path.isfile(output_filename): + with open(output_filename, 'rb') as f: + # PDF is a nb supported binary, data type, so base64 encode. +- return base64.encodestring(f.read()) ++ return base64.encodebytes(f.read()) + else: + raise TypeError("Inkscape svg to pdf conversion failed") diff --git a/f072d782dd.patch b/f072d782dd.patch new file mode 100644 index 0000000..c184ccb --- /dev/null +++ b/f072d782dd.patch @@ -0,0 +1,26 @@ +From 1083fcf9c900131748ecd2631722bfa179e53100 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Lum=C3=ADr=20=27Frenzy=27=20Balhar?= + +Date: Fri, 27 Mar 2020 09:24:15 +0100 +Subject: [PATCH] cElementTree no longer exists in Python 3.9 + +Fixes: https://github.com/jupyter/nbconvert/issues/1221 +--- + nbconvert/filters/strings.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/nbconvert/filters/strings.py b/nbconvert/filters/strings.py +index 2673d661..9ae82a13 100755 +--- a/nbconvert/filters/strings.py ++++ b/nbconvert/filters/strings.py +@@ -19,8 +19,8 @@ + from urllib2 import quote # Py 2 + + # defusedxml does safe(r) parsing of untrusted XML data +-from defusedxml import cElementTree as ElementTree +-from xml.etree.cElementTree import Element ++from defusedxml import ElementTree ++from xml.etree.ElementTree import Element + + from ipython_genutils import py3compat + diff --git a/python-nbconvert.spec b/python-nbconvert.spec index 40a77e1..cf4714b 100644 --- a/python-nbconvert.spec +++ b/python-nbconvert.spec @@ -13,6 +13,10 @@ Source0: %pypi_source # https://github.com/jupyter/nbconvert/pull/1247 Patch1: inkscape-1.0rc1.patch +# Python 3.9 compatibility +Patch2: https://github.com/jupyter/nbconvert/commit/d9a893bf60.patch +Patch3: https://github.com/jupyter/nbconvert/commit/f072d782dd.patch + BuildArch: noarch BuildRequires: python3-pandocfilters @@ -84,9 +88,6 @@ Documentation for nbconvert %autosetup -p1 -n %{pypi_name}-%{version} rm -rf %{pypi_name}.egg-info -# https://github.com/jupyter/nbconvert/issues/1221 -sed -i 's/cElementTree/ElementTree/' nbconvert/filters/strings.py - %build %py3_build