Bug#1001824: xml2rfc: Incompatible with current weaseyprint

2021-12-17 Thread Scott Kitterman
On Thu, 16 Dec 2021 23:28:26 -0500 Scott Kitterman  
wrote:
> 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:

dkg,

Unless you want to object, I think we should go ahead and make this change.  I 
don't get the impression that since the IETF LLC booted Henrik there's much 
upstream going on, so I don't see much point in waiting for them.

Scott K

signature.asc
Description: This is a digitally signed message part.


Bug#1001824: xml2rfc: Incompatible with current weaseyprint

2021-12-16 Thread Scott Kitterman
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.py2021-12-16 10:31:27.861538832 -0500
+++ b/xml2rfc/run.py2021-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: