diff --git a/590-rm-getStringIO.patch b/590-rm-getStringIO.patch new file mode 100644 index 0000000..768aec9 --- /dev/null +++ b/590-rm-getStringIO.patch @@ -0,0 +1,32 @@ +From 7627296bdbab4cbd81ca91d655a9605f6630664f Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?An=C5=BEe=20Pe=C4=8Dar?= +Date: Fri, 18 Feb 2022 15:44:13 +0000 +Subject: [PATCH] Remove usage of getStringIO + +reportlab 3.6.7 removed getStringIO and getByteIO: https://github.com/MrBitBucket/reportlab-mirror/commit/684d21e2da8f835ca3670e78cc9a011ba71a7e9a + +This should resolve: Cannot import name 'getStringIO' from 'reportlab.lib.utils' #589 +--- + xhtml2pdf/xhtml2pdf_reportlab.py | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +--- a/xhtml2pdf/xhtml2pdf_reportlab.py ++++ b/xhtml2pdf/xhtml2pdf_reportlab.py +@@ -17,7 +17,7 @@ + from hashlib import md5 + from reportlab.lib.enums import TA_RIGHT + from reportlab.lib.styles import ParagraphStyle +-from reportlab.lib.utils import flatten, open_for_read, getStringIO, \ ++from reportlab.lib.utils import flatten, open_for_read, \ + LazyImageReader, haveImages + from reportlab.platypus.doctemplate import BaseDocTemplate, PageTemplate, IndexingFlowable + from reportlab.platypus.flowables import Flowable, CondPageBreak, \ +@@ -338,7 +338,7 @@ class PmlImageReader(object): # TODO We + register_reset(self._cache.clear) + + data = self._cache.setdefault(md5(data).digest(), data) +- self.fp = getStringIO(data) ++ self.fp = six.StringIO(data) + elif imageReaderFlags == - 1 and isinstance(fileName, six.text_type): + #try Ralf Schmitt's re-opening technique of avoiding too many open files + self.fp.close() diff --git a/python-xhtml2pdf.changes b/python-xhtml2pdf.changes index dc255c8..6e41daf 100644 --- a/python-xhtml2pdf.changes +++ b/python-xhtml2pdf.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Sat Apr 9 13:23:48 UTC 2022 - Matej Cepl + +- Add 590-rm-getStringIO.patch, use standard StringIO + (gh#xhtml2pdf/xhtml2pdf#589). + ------------------------------------------------------------------- Sun Feb 7 14:49:02 UTC 2021 - John Vandenberg diff --git a/python-xhtml2pdf.spec b/python-xhtml2pdf.spec index a92aaa0..01b203a 100644 --- a/python-xhtml2pdf.spec +++ b/python-xhtml2pdf.spec @@ -1,7 +1,7 @@ # # spec file for package python-xhtml2pdf # -# Copyright (c) 2021 SUSE LLC +# Copyright (c) 2022 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -25,17 +25,10 @@ License: Apache-2.0 Group: Development/Languages/Python URL: https://github.com/xhtml2pdf/xhtml2pdf Source: https://github.com/xhtml2pdf/xhtml2pdf/archive/%{version}.tar.gz#/xhtml2pdf-%{version}.tar.gz +# PATCH-FIX-UPSTREAM 590-rm-getStringIO.patch gh#xhtml2pdf/xhtml2pdf#589 mcepl@suse.com +# Remove usage of getStringIO +Patch0: 590-rm-getStringIO.patch BuildRequires: %{python_module setuptools} -# SECTION test requirements -BuildRequires: %{python_module Pillow >= 7.0.2} -BuildRequires: %{python_module PyPDF2 >= 1.26} -BuildRequires: %{python_module arabic-reshaper >= 2.1.0} -BuildRequires: %{python_module html5lib >= 1.0} -BuildRequires: %{python_module pytest} -BuildRequires: %{python_module python-bidi >= 0.4.2} -BuildRequires: %{python_module reportlab >= 3.0} -BuildRequires: %{python_module six} -# /SECTION BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-Pillow >= 7.0.2 @@ -47,9 +40,19 @@ Requires: python-reportlab >= 3.0 Requires: python-setuptools Requires: python-six Requires(post): update-alternatives -Requires(postun): update-alternatives +Requires(postun):update-alternatives Conflicts: python-pisa BuildArch: noarch +# SECTION test requirements +BuildRequires: %{python_module Pillow >= 7.0.2} +BuildRequires: %{python_module PyPDF2 >= 1.26} +BuildRequires: %{python_module arabic-reshaper >= 2.1.0} +BuildRequires: %{python_module html5lib >= 1.0} +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module python-bidi >= 0.4.2} +BuildRequires: %{python_module reportlab >= 3.0} +BuildRequires: %{python_module six} +# /SECTION %python_subpackages %description @@ -62,6 +65,8 @@ able to generate PDF templates very quickly without learning new technologies. %prep %setup -q -n xhtml2pdf-%{version} +%autopatch -p1 + sed -i '1{/^#!/d}' xhtml2pdf/paragraph.py xhtml2pdf/w3c/*.py %build