• Bug#1064037: xhtml2pdf: the new version of python-reportlab breaks xhtm

    From Georges Khaznadar@21:1/5 to All on Fri Feb 16 10:40:01 2024
    This is a multi-part MIME message sent by reportbug.


    Source: xhtml2pdf
    Version: 0.2.5-3
    Severity: serious
    Tags: patch upstream

    Dear Maintainer,

    since python-reportlab 4.0.1-1, xhtml2pdf cannot pass automatic tests:
    see for example, https://ci.debian.net/packages/x/xhtml2pdf/testing/amd64/43022906/
    at line 480,
    from reportlab.platypus.frames import Frame, ShowBoundaryValue
    E ImportError: cannot import name 'ShowBoundaryValue' from 'reportlab.platypus.frames' (/usr/lib/python3/dist- packages/reportlab/platypus/frames.py)

    I patched the file xhtml2pdf/context.py to fix this error.

    Best regards, Georges.


    -- System Information:
    Debian Release: trixie/sid
    APT prefers stable
    APT policy: (700, 'stable'), (650, 'testing'), (500, 'stable-updates'), (500, 'stable-security'), (500, 'oldstable-updates'), (500, 'oldstable-security'), (500, 'oldoldstable'), (500, 'unstable'), (500, 'oldstable')
    Architecture: amd64 (x86_64)

    Kernel: Linux 4.19.0-25-amd64 (SMP w/4 CPU threads)
    Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
    Shell: /bin/sh linked to /usr/bin/dash
    Init: systemd (via /run/systemd/system)
    LSM: AppArmor: enabled

    Beginning with python3-reporlab version 4.1.0, ShowBoundaryValue is no longer part
    of reportlab.platypus.frames, but part of reportlab.pdfgen.canvas

    Index: xhtml2pdf/xhtml2pdf/context.py ===================================================================
    --- xhtml2pdf.orig/xhtml2pdf/context.py
    +++ xhtml2pdf/xhtml2pdf/context.py
    @@ -15,7 +15,8 @@ from reportlab.lib.pagesizes import A4
    from reportlab.lib.styles import ParagraphStyle
    from reportlab.pdfbase import pdfmetrics
    from reportlab.pdfbase.ttfonts import TTFont
    -from reportlab.platypus.frames import Frame, ShowBoundaryValue
    +from reportlab.platypus.frames import Frame
    +from reportlab.pdfgen.canvas import ShowBoundaryValue
    from reportlab.platypus.paraparser import ParaFrag, ps2tt, tt2ps
    from xhtml2pdf.util import (copy_attrs, getColor, getCoords, getFile,
    getFrameDimensions, getSize, pisaFileObject,

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)