#8 F32: Recommend Inkscape for SVG to PDF conversion, fix compatibility with 1.0rc1+
Merged 2 years ago by nonamedotc. Opened 2 years ago by churchyard.
rpms/ churchyard/python-nbconvert inkscape  into  f32

file added
+21
@@ -0,0 +1,21 @@ 

+ From d9a893bf60e0e028259c953f2c9e272f0ae1b6c9 Mon Sep 17 00:00:00 2001

+ From: Karthikeyan Singaravelan <tir.karthi@gmail.com>

+ 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")

file added
+26
@@ -0,0 +1,26 @@ 

+ From 1083fcf9c900131748ecd2631722bfa179e53100 Mon Sep 17 00:00:00 2001

+ From: =?UTF-8?q?Lum=C3=ADr=20=27Frenzy=27=20Balhar?=

+  <frenzy.madness@gmail.com>

+ 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

+  

@@ -0,0 +1,13 @@ 

+ diff --git a/nbconvert/preprocessors/svg2pdf.py b/nbconvert/preprocessors/svg2pdf.py

+ index 60b23b8..e100042 100644

+ --- a/nbconvert/preprocessors/svg2pdf.py

+ +++ b/nbconvert/preprocessors/svg2pdf.py

+ @@ -53,7 +53,7 @@ class SVG2PDFPreprocessor(ConvertFiguresPreprocessor):

+      @default('command')

+      def _command_default(self):

+          return self.inkscape + \

+ -               ' --without-gui --export-pdf="{to_filename}" "{from_filename}"'

+ +               ' --export-filename="{to_filename}" "{from_filename}"'

+      

+      inkscape = Unicode(help="The path to Inkscape, if necessary").tag(config=True)

+      @default('inkscape')

file modified
+20 -3
@@ -2,12 +2,21 @@ 

  

  Name:           python-%{pypi_name}

  Version:        5.6.0

- Release:        3%{?dist}

+ Release:        4%{?dist}

  Summary:        Converting Jupyter Notebooks

  

  License:        BSD and MIT

  URL:            http://jupyter.org

  Source0:        %pypi_source

+ 

+ # Compatibility with Inkscape 1.0rc1+

+ # 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
@@ -46,6 +55,8 @@ 

  #BuildRequires:  python3-pebble -- not yet packaged

  BuildRequires:  python3-pytest

  #BuildRequires:  texlive-xetex -- those are failing for now

+ BuildRequires:  inkscape

+ BuildRequires:  pandoc

  %endif

  

  
@@ -60,7 +71,8 @@ 

  %{?python_provide:%python_provide python3-%{pypi_name}}

  

  Requires:       %{py3_dist setuptools}

- %{?python_enable_dependency_generator}

+ Recommends:     inkscape

+ Recommends:     pandoc

  

  %description -n python3-%{pypi_name}

  
@@ -75,7 +87,7 @@ 

  Documentation for nbconvert

  

  %prep

- %autosetup -n %{pypi_name}-%{version}

+ %autosetup -p1 -n %{pypi_name}-%{version}

  rm -rf %{pypi_name}.egg-info

  

  %build
@@ -120,6 +132,11 @@ 

  %endif

  

  %changelog

+ * Sun May 03 2020 Miro Hrončok <mhroncok@redhat.com> - 5.6.0-4

+ - Recommend Inkscape for SVG to PDF conversion (#1830647)

+ - Fix compatibility with Inkscape 1.0rc1

+ - Recommend Pandoc for format conversions

+ 

  * Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 5.6.0-3

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

  

no initial comment

1 new commit added

  • Replace the Python 3.9 compatibility sed with upstream commits
2 years ago

1 new commit added

  • Recommend Pandoc for format conversions
2 years ago

Pull-Request has been merged by nonamedotc

2 years ago

@nonamedotc will you handle the builds and updates?