Package: xml2rfc
Version: 3.12.0-1
Severity: serious
Tags: ftbfs upstream patch
Justification: fails to build from source

Note: Using ftbfs because that's the closest thing we have to an
autopkgtest failure.

The new version of weasyprint no longer uses the same PDF generation
libraries and as a result, xml2rfc's detection mechanism for if it is
capable of making a PDF is not working (see attached patch).

Once the detection mechanism is patched, PDF generation works fine,
which leads me to believe the test failure is bogus:

======================================================================
FAIL: test_text_content (__main__.PdfWriterTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/xml2rfc-3.12.0/test.py", line 510, in test_text_content
    self.assertIn(t, text)
AssertionError: 'RFC' not found in 'l- WN –&,ÛžÆ TNDQ&·sX l-%Zñ¢<³ WN P½RÔ n®>Ø 
%˜oh l† .µ ¬( .µ=N'

----------------------------------------------------------------------

If things were really that garbled, I don't see how it could make a PDF.

Reported upstream:

https://trac.ietf.org/trac/xml2rfc/ticket/696

In the interim, I think it might make sense to apply the attached patch
and get rid of the failing test.  If we go down this path, then this
will also need fixing (get rid of HAVE_CAIRO and HAVE_PANGO):

xml2rfc-3.12.0/test.py", line 513, in test_included_fonts
    if xml2rfc.HAVE_WEASYPRINT and xml2rfc.HAVE_PYCAIRO and xml2rfc.HAVE_CAIRO 
and xml2rfc.HAVE_PANGO:

Scott K
diff -ruN a/xml2rfc/__init__.py b/xml2rfc/__init__.py
--- a/xml2rfc/__init__.py       2021-12-16 10:31:27.857538775 -0500
+++ b/xml2rfc/__init__.py       2021-12-16 22:56:51.310061387 -0500
@@ -40,21 +40,6 @@
 except (ImportError, OSError):
     cairo = False
     HAVE_PYCAIRO = False
-try:
-    from weasyprint.text import cairo
-    HAVE_CAIRO = True
-    CAIRO_VERSION = cairo.cairo_version()
-except (ImportError, OSError):
-    HAVE_CAIRO = False
-    CAIRO_VERSION = None
-try:
-    from weasyprint.text import pango
-    HAVE_PANGO = True
-    PANGO_VERSION = pango.pango_version
-except (ImportError, OSError, AttributeError):
-    HAVE_PANGO = False
-    PANGO_VERSION = None
-
 
 def get_versions():
     import sys
diff -ruN a/xml2rfc/run.py b/xml2rfc/run.py
--- a/xml2rfc/run.py    2021-12-16 10:31:27.861538832 -0500
+++ b/xml2rfc/run.py    2021-12-16 23:00:12.948957766 -0500
@@ -35,10 +35,6 @@
         missing += "\nCould not import weasyprint"
     if not xml2rfc.HAVE_PYCAIRO:
         missing += "\nCould not import pycairo"
-    if not xml2rfc.HAVE_CAIRO:
-        missing += "\nCould not find the cairo lib"
-    if not xml2rfc.HAVE_PANGO:
-        missing += "\nCould not find the pango lib"
     return missing
 
 
@@ -212,7 +208,7 @@
                            help='outputs formatted HTML to file')
     formatgroup.add_argument('--nroff', action='store_true',
                            help='outputs formatted nroff to file (only v2 
input)')
-    if xml2rfc.HAVE_CAIRO and xml2rfc.HAVE_PANGO:
+    if xml2rfc.HAVE_PYCAIRO and xml2rfc.HAVE_WEASYPRINT:
         formatgroup.add_argument('--pdf', action='store_true',
                                help='outputs formatted PDF to file')
     else:

Reply via email to