Hello community,

here is the log from the commit of package python-xhtml2pdf for 
openSUSE:Factory checked in at 2020-02-07 15:53:38
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-xhtml2pdf (Old)
 and      /work/SRC/openSUSE:Factory/.python-xhtml2pdf.new.26092 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "python-xhtml2pdf"

Fri Feb  7 15:53:38 2020 rev:3 rq:770564 version:0.2.4

Changes:
--------
--- /work/SRC/openSUSE:Factory/python-xhtml2pdf/python-xhtml2pdf.changes        
2019-03-08 11:02:35.484529417 +0100
+++ 
/work/SRC/openSUSE:Factory/.python-xhtml2pdf.new.26092/python-xhtml2pdf.changes 
    2020-02-07 15:54:27.067512074 +0100
@@ -1,0 +2,9 @@
+Thu Feb  6 12:19:52 UTC 2020 - Marketa Calabkova <[email protected]>
+
+- update to 0.2.4
+  * add Python 3.8
+  * Fixed padding problem
+  * fix: use html.escape instead of cgi.escape
+  * Removed `if cols_with_no_width` condition from `tables.py`.
+
+-------------------------------------------------------------------

Old:
----
  xhtml2pdf-0.2.3.tar.gz

New:
----
  xhtml2pdf-0.2.4.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ python-xhtml2pdf.spec ++++++
--- /var/tmp/diff_new_pack.5tG3WD/_old  2020-02-07 15:54:28.023512597 +0100
+++ /var/tmp/diff_new_pack.5tG3WD/_new  2020-02-07 15:54:28.027512599 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package python-xhtml2pdf
 #
-# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,27 +18,27 @@
 
 %{?!python_module:%define python_module() python-%{**} python3-%{**}}
 Name:           python-xhtml2pdf
-Version:        0.2.3
+Version:        0.2.4
 Release:        0
 Summary:        PDF Generator Using HTML and CSS
 License:        Apache-2.0
 Group:          Development/Languages/Python
 URL:            https://github.com/xhtml2pdf/xhtml2pdf
 Source:         
https://files.pythonhosted.org/packages/source/x/xhtml2pdf/xhtml2pdf-%{version}.tar.gz
+# leaving the requirements here as the tests will start working one day
 BuildRequires:  %{python_module Pillow >= 2.0}
 BuildRequires:  %{python_module PyPDF2 >= 1.26}
+BuildRequires:  %{python_module coverage}
 BuildRequires:  %{python_module html5lib >= 1.0}
-BuildRequires:  %{python_module httplib2 >= 0.7.6}
 BuildRequires:  %{python_module nose >= 1.3.3}
 BuildRequires:  %{python_module reportlab >= 3.0}
 BuildRequires:  %{python_module setuptools}
 BuildRequires:  %{python_module six}
 BuildRequires:  fdupes
 BuildRequires:  python-rpm-macros
-Requires:       python-Pillow >= 2.0
+Requires:       python-Pillow >= 2.0.0
 Requires:       python-PyPDF2 >= 1.26
 Requires:       python-html5lib >= 1.0
-Requires:       python-httplib2 >= 0.7.6
 Requires:       python-reportlab >= 3.0
 Requires:       python-six
 Conflicts:      python-pisa
@@ -63,7 +63,8 @@
 %python_install
 %python_expand %fdupes %{buildroot}%{$python_sitelib}
 
-# there are no test actually
+%check
+# as in setup.py: test_suite = "tests", They're not even working yet
 
 %files %{python_files}
 %license LICENSE.txt

++++++ xhtml2pdf-0.2.3.tar.gz -> xhtml2pdf-0.2.4.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xhtml2pdf-0.2.3/PKG-INFO new/xhtml2pdf-0.2.4/PKG-INFO
--- old/xhtml2pdf-0.2.3/PKG-INFO        2018-09-14 18:40:29.000000000 +0200
+++ new/xhtml2pdf-0.2.4/PKG-INFO        2020-01-18 07:17:53.000000000 +0100
@@ -1,10 +1,11 @@
-Metadata-Version: 1.1
+Metadata-Version: 1.2
 Name: xhtml2pdf
-Version: 0.2.3
+Version: 0.2.4
 Summary: PDF generator using HTML and CSS
 Home-page: http://github.com/xhtml2pdf/xhtml2pdf
-Author: Luis Zarate
-Author-email: [email protected]
+Author: Dirk Holtwick
+Maintainer: Luis Zarate
+Maintainer-email: [email protected]
 License: Apache License 2.0
 Description: XHTML2PDF
         =========
@@ -219,6 +220,8 @@
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
 Classifier: Topic :: Documentation
 Classifier: Topic :: Multimedia
 Classifier: Topic :: Office/Business
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xhtml2pdf-0.2.3/setup.py new/xhtml2pdf-0.2.4/setup.py
--- old/xhtml2pdf-0.2.3/setup.py        2018-08-08 22:35:56.000000000 +0200
+++ new/xhtml2pdf-0.2.4/setup.py        2020-01-18 07:15:50.000000000 +0100
@@ -64,6 +64,8 @@
         'Programming Language :: Python :: 3.4',
         'Programming Language :: Python :: 3.5',
         'Programming Language :: Python :: 3.6',
+        'Programming Language :: Python :: 3.7',
+        'Programming Language :: Python :: 3.8',
         'Topic :: Documentation',
         'Topic :: Multimedia',
         'Topic :: Office/Business',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xhtml2pdf-0.2.3/xhtml2pdf/__init__.py 
new/xhtml2pdf-0.2.4/xhtml2pdf/__init__.py
--- old/xhtml2pdf-0.2.3/xhtml2pdf/__init__.py   2018-09-14 18:37:22.000000000 
+0200
+++ new/xhtml2pdf-0.2.4/xhtml2pdf/__init__.py   2020-01-18 07:15:18.000000000 
+0100
@@ -13,4 +13,4 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-__version__ = "0.2.3"
+__version__ = "0.2.4"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xhtml2pdf-0.2.3/xhtml2pdf/document.py 
new/xhtml2pdf-0.2.4/xhtml2pdf/document.py
--- old/xhtml2pdf-0.2.3/xhtml2pdf/document.py   2018-08-08 22:35:00.000000000 
+0200
+++ new/xhtml2pdf-0.2.4/xhtml2pdf/document.py   2020-01-18 07:03:21.000000000 
+0100
@@ -10,6 +10,12 @@
 from xhtml2pdf.util import pisaTempFile, getBox, PyPDF2
 import cgi
 import logging
+import six
+
+if not six.PY2:
+    from html import escape as html_escape
+else:
+    from cgi import escape as html_escape
 
 # Copyright 2010 Dirk Holtwick, holtwick.it
 #
@@ -33,12 +39,14 @@
     out.write("<p style='background-color:red;'><strong>%d error(s) 
occured:</strong><p>" % c.err)
     for mode, line, msg, _ in c.log:
         if mode == "error":
-            out.write("<pre>%s in line %d: %s</pre>" % (mode, line, 
cgi.escape(msg)))
+            out.write("<pre>%s in line %d: %s</pre>" %
+                      (mode, line, html_escape(msg)))
 
     out.write("<p><strong>%d warning(s) occured:</strong><p>" % c.warn)
     for mode, line, msg, _ in c.log:
         if mode == "warning":
-            out.write("<p>%s in line %d: %s</p>" % (mode, line, 
cgi.escape(msg)))
+            out.write("<p>%s in line %d: %s</p>" %
+                      (mode, line, html_escape(msg)))
 
     return pisaDocument(out.getvalue(), dest, raise_exception=False)
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xhtml2pdf-0.2.3/xhtml2pdf/tables.py 
new/xhtml2pdf-0.2.4/xhtml2pdf/tables.py
--- old/xhtml2pdf-0.2.3/xhtml2pdf/tables.py     2018-08-08 22:35:00.000000000 
+0200
+++ new/xhtml2pdf-0.2.4/xhtml2pdf/tables.py     2020-01-18 07:03:21.000000000 
+0100
@@ -183,17 +183,6 @@
         for i, row in enumerate(data):
             data[i] += [''] * (maxcols - len(row))
 
-        cols_with_no_width = [
-            tup for tup in enumerate(tdata.colw) if tup[1] is None or tup[1] 
== 0.0]
-
-        if cols_with_no_width:  # any col width not defined
-            log.debug(list(enumerate(tdata.colw)))
-            fair_division = str(100 / float(len(cols_with_no_width))) + '%'
-            log.debug("Fair division: {}".format(fair_division))
-            for i, _ in cols_with_no_width:
-                log.debug("Setting {} to {}".format(i, fair_division))
-                tdata.colw[i] = fair_division
-
         log.debug("Col widths: {}".format(list(tdata.colw)))
         if tdata.data:
             # log.debug("Table styles %r", tdata.styles)
@@ -234,7 +223,9 @@
 
         tdata.add_cell_styles(c, begin, end, "tr")
         c.frag.vAlign = self.attr.valign or c.frag.vAlign
-
+        if c.frag.backColor:
+            tdata.add_style(('BACKGROUND', begin, end, c.frag.backColor))
+            
         tdata.col = 0
         tdata.data.append([])
 
@@ -305,7 +296,8 @@
                 if len(self.node.childNodes) == 0:
                     width = c.frag.paddingLeft + c.frag.paddingRight
                     log.debug("Col {} has width {}".format(col, width))
-                    tdata.colw[col] = _width(width)
+                    if width:
+                        tdata.colw[col] = _width(width)
                 else:
                     # Child nodes are present, we cannot do anything about the
                     # width except set it externally.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xhtml2pdf-0.2.3/xhtml2pdf/util.py 
new/xhtml2pdf-0.2.4/xhtml2pdf/util.py
--- old/xhtml2pdf-0.2.3/xhtml2pdf/util.py       2018-09-14 18:36:48.000000000 
+0200
+++ new/xhtml2pdf-0.2.4/xhtml2pdf/util.py       2020-01-18 07:03:21.000000000 
+0100
@@ -142,7 +142,7 @@
     Allows to apply one function to set of keys cheching if key is in 
container,
     also trasform ccs key to report lab keys.
 
-    extras = Are extra params for func, it will be call like func(*[param1, 
param2]) 
+    extras = Are extra params for func, it will be call like func(*[param1, 
param2])
 
     obj = frag
     keys = [(reportlab, css), ... ]
@@ -167,7 +167,7 @@
 def copy_attrs(obj1, obj2, attrs):
     """
     Allows copy a list of attributes from object2 to object1.
-    Useful for copy ccs attributes to fragment  
+    Useful for copy ccs attributes to fragment
     """
     for attr in attrs:
         value = getattr(obj2, attr) if hasattr(obj2, attr) else None
@@ -178,7 +178,7 @@
 
 def set_value(obj, attrs, value, _copy=False):
     """
-    Allows set the same value to a list of attributes 
+    Allows set the same value to a list of attributes
     """
     for attr in attrs:
         if _copy:
@@ -300,7 +300,10 @@
         elif value in ("none", "0", "auto"):
             return 0.0
         elif relative:
-            if value[-2:] == 'em':  # XXX
+            if value[-3:] == 'rem':  # XXX
+                # 1rem = 1 * fontSize
+                return float(value[:-3].strip()) * relative
+            elif value[-2:] == 'em':  # XXX
                 # 1em = 1 * fontSize
                 return float(value[:-2].strip()) * relative
             elif value[-2:] == 'ex':  # XXX
@@ -583,6 +586,7 @@
     """
 
     def __init__(self, uri, basepath=None):
+
         self.basepath = basepath
         self.mimetype = None
         self.file = None
@@ -591,7 +595,7 @@
         self.local = None
         self.tmp_file = None
         uri = uri or str()
-        if type(uri) != str:
+        if not isinstance(uri, str):
             uri = uri.decode("utf-8")
         log.debug("FileObject %r, Basepath: %r", uri, basepath)
 
@@ -599,7 +603,18 @@
         if uri.startswith("data:"):
             m = _rx_datauri.match(uri)
             self.mimetype = m.group("mime")
-            b64 = urllib_unquote(m.group("data")).encode("utf-8")
+
+            b64 = urllib_unquote(m.group("data"))
+
+            # The data may be incorrectly unescaped... repairs needed
+            b64 = b64.strip("b'").strip("'").encode()
+            b64 = re.sub(b"\\n", b'', b64)
+            b64 = re.sub(b'[^A-Za-z0-9\+\/]+', b'', b64)
+
+            # Add padding as needed, to make length into a multiple of 4
+            #
+            b64 += b"=" * ((4 - len(b64) % 4) % 4)
+
             self.data = base64.b64decode(b64)
 
         else:
@@ -636,7 +651,10 @@
                 #mimetype = getMimeType(path)
 
                 # Using HTTPLIB
-                server, path = urllib2.splithost(uri[uri.find("//"):])
+                url_splitted = urlparse.urlsplit(uri)
+                server = url_splitted[1]
+                path = url_splitted[2]
+                path += "?" + url_splitted[3] if url_splitted[3] else ""
                 if uri.startswith("https://";):
                     conn = httplib.HTTPSConnection(server,  **httpConfig)
                 else:
@@ -653,7 +671,7 @@
                         import gzip
 
                         self.file = gzip.GzipFile(
-                            mode="rb", fileobj=six.StringIO(r1.read()))
+                            mode="rb", fileobj=six.BytesIO(r1.read()))
                     else:
                         self.file = pisaTempFile(r1.read())
                 else:
@@ -675,6 +693,8 @@
 
                 # Local data
                 if basepath:
+                    if sys.platform == 'win32' and os.path.isfile(basepath):
+                        basepath = os.path.dirname(basepath)
                     uri = os.path.normpath(os.path.join(basepath, uri))
 
                 if os.path.isfile(uri):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xhtml2pdf-0.2.3/xhtml2pdf/w3c/css.py 
new/xhtml2pdf-0.2.4/xhtml2pdf/w3c/css.py
--- old/xhtml2pdf-0.2.3/xhtml2pdf/w3c/css.py    2018-08-08 22:35:00.000000000 
+0200
+++ new/xhtml2pdf-0.2.4/xhtml2pdf/w3c/css.py    2020-01-18 07:03:21.000000000 
+0100
@@ -287,32 +287,22 @@
     def __str__(self):
         return self.asString()
 
+
+    def _as_comparison_key(self):
+        return (self.specificity(), self.fullName, self.qualifiers)
+
+
     def __eq__(self, other):
         """Python 3"""
-        return (
-            self.specificity() == other.specificity() and
-            self.fullName == other.fullName and
-            self.qualifiers == other.qualifiers
-        )
+        return self._as_comparison_key() == other._as_comparison_key()
 
     def __lt__(self, other):
         """Python 3"""
-        return not self.__eq__(other) and (
-            self.specificity() < other.specificity() or
-            self.fullName < other.fullName or
-            self.qualifiers < other.qualifiers
-        )
+        return self._as_comparison_key() < other._as_comparison_key()
 
     def __cmp__(self, other):
         """Python 2"""
-        result = cmp(self.specificity(), other.specificity())  # silence 
pyflakes
-        if result != 0:
-            return result
-        result = cmp(self.fullName, other.fullName)  # silence pyflakes
-        if result != 0:
-            return result
-        result = cmp(self.qualifiers, other.qualifiers)  # silence pyflakes
-        return result
+        return cmp(self._as_comparison_key(), other._as_comparison_key())
 
 
     def specificity(self):
@@ -639,24 +629,16 @@
         return '%s%s' % (self.selector.asString(), self.op)
 
     def matches(self, element):
-        if self.op == ' ':
-            if element is not None:
-                if element.matchesNode(self.selector.fullName):
-                    try:
-                        for parent in element.iterXMLParents():
-                            [None for qualifier in self.selector.qualifiers if
-                             qualifier.matches(parent) and stopIter((None,))]
-                    except StopIteration:
-                        return True
-            return False
-        elif self.op == '>':
-            if element is not None:
-                if element.matchesNode(self.selector.fullName):
-                    if self.selector.qualifiers[0].matches(element):
-                        return True
-            return False
-        elif self.op == '+':
-            return self.selector.matches(element.getPreviousSibling())
+        op, selector = self.op, self.selector
+        if op == ' ':
+            return any(selector.matches(parent) for parent in 
element.iterXMLParents())
+        elif op == '>':
+            parent = next(element.iterXMLParents(), None)
+            if parent is None:
+                return False
+            return selector.matches(parent)
+        elif op == '+':
+            return selector.matches(element.getPreviousSibling())
 
 
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xhtml2pdf-0.2.3/xhtml2pdf/w3c/cssParser.py 
new/xhtml2pdf-0.2.4/xhtml2pdf/w3c/cssParser.py
--- old/xhtml2pdf-0.2.3/xhtml2pdf/w3c/cssParser.py      2018-08-08 
22:35:00.000000000 +0200
+++ new/xhtml2pdf-0.2.4/xhtml2pdf/w3c/cssParser.py      2020-01-18 
07:03:21.000000000 +0100
@@ -363,7 +363,7 @@
         re_class = re.compile(i_class, _reflags)
         i_hash = '#((?:%s)+)' % i_nmchar
         re_hash = re.compile(i_hash, _reflags)
-        i_rgbcolor = '(#%s{6}|#%s{3})' % (i_hex, i_hex)
+        i_rgbcolor = '(#%s{8}|#%s{6}|#%s{3})' % (i_hex, i_hex, i_hex)
         re_rgbcolor = re.compile(i_rgbcolor, _reflags)
         i_nl = '\n|\r\n|\r|\f'
         i_escape_nl = '\\\\(?:%s)' % i_nl
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xhtml2pdf-0.2.3/xhtml2pdf/xhtml2pdf_reportlab.py 
new/xhtml2pdf-0.2.4/xhtml2pdf/xhtml2pdf_reportlab.py
--- old/xhtml2pdf-0.2.3/xhtml2pdf/xhtml2pdf_reportlab.py        2018-08-08 
22:35:00.000000000 +0200
+++ new/xhtml2pdf-0.2.4/xhtml2pdf/xhtml2pdf_reportlab.py        2020-01-18 
07:03:21.000000000 +0100
@@ -43,6 +43,11 @@
     except:
         PILImage = None
 
+if not six.PY2:
+    from html import escape as html_escape
+else:
+    from cgi import escape as html_escape
+
 log = logging.getLogger("xhtml2pdf")
 
 MAX_IMAGE_RATIO = 0.95
@@ -119,7 +124,7 @@
         if getattr(flowable, "outline", False):
             self.notify('TOCEntry', (
                 flowable.outlineLevel,
-                cgi.escape(copy.deepcopy(flowable.text), 1),
+                html_escape(copy.deepcopy(flowable.text), 1),
                 self.page))
 
     def handle_nextPageTemplate(self, pt):
@@ -150,7 +155,7 @@
             #collect the refs to the template objects, complain if any are bad
             c = PTCycle()
             for ptn in pt:
-            #special case name used to short circuit the iteration
+                #special case name used to short circuit the iteration
                 if ptn == '*':
                     c._restart = len(c)
                     continue
@@ -249,13 +254,12 @@
                 else:
                     pisaBackground = self.pisaBackground
 
-            if pisaBackground:
-                self.pisaBackgroundList.append(pisaBackground)
-            else:
-                if self.isPortrait():
-                    canvas.drawImage(self.img, 0, self.ph - self.h, self.w, 
self.h)
-                elif self.isLandscape():
-                    canvas.drawImage(self.img, 0, 0, self.w, self.h)
+            self.pisaBackgroundList.append(pisaBackground)
+
+            if self.isPortrait():
+                canvas.drawImage(self.img, 0, self.ph - self.h, self.w, self.h)
+            elif self.isLandscape():
+                canvas.drawImage(self.img, 0, 0, self.w, self.h)
 
             def pageNumbering(objList):
                 for obj in flatten(objList):
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xhtml2pdf-0.2.3/xhtml2pdf.egg-info/PKG-INFO 
new/xhtml2pdf-0.2.4/xhtml2pdf.egg-info/PKG-INFO
--- old/xhtml2pdf-0.2.3/xhtml2pdf.egg-info/PKG-INFO     2018-09-14 
18:40:28.000000000 +0200
+++ new/xhtml2pdf-0.2.4/xhtml2pdf.egg-info/PKG-INFO     2020-01-18 
07:17:53.000000000 +0100
@@ -1,10 +1,11 @@
-Metadata-Version: 1.1
+Metadata-Version: 1.2
 Name: xhtml2pdf
-Version: 0.2.3
+Version: 0.2.4
 Summary: PDF generator using HTML and CSS
 Home-page: http://github.com/xhtml2pdf/xhtml2pdf
-Author: Luis Zarate
-Author-email: [email protected]
+Author: Dirk Holtwick
+Maintainer: Luis Zarate
+Maintainer-email: [email protected]
 License: Apache License 2.0
 Description: XHTML2PDF
         =========
@@ -219,6 +220,8 @@
 Classifier: Programming Language :: Python :: 3.4
 Classifier: Programming Language :: Python :: 3.5
 Classifier: Programming Language :: Python :: 3.6
+Classifier: Programming Language :: Python :: 3.7
+Classifier: Programming Language :: Python :: 3.8
 Classifier: Topic :: Documentation
 Classifier: Topic :: Multimedia
 Classifier: Topic :: Office/Business
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/xhtml2pdf-0.2.3/xhtml2pdf.egg-info/requires.txt 
new/xhtml2pdf-0.2.4/xhtml2pdf.egg-info/requires.txt
--- old/xhtml2pdf-0.2.3/xhtml2pdf.egg-info/requires.txt 2018-09-14 
18:40:28.000000000 +0200
+++ new/xhtml2pdf-0.2.4/xhtml2pdf.egg-info/requires.txt 2020-01-18 
07:17:53.000000000 +0100
@@ -1,5 +1,5 @@
-Pillow
 html5lib>=1.0
 pyPdf2
+Pillow
 reportlab>=3.0
 six


Reply via email to