GNU bug report logs - #37617
[PATCH 0/6] Add weasyprint and dependencies.

Previous Next

Package: guix-patches;

Reported by: Hartmut Goebel <h.goebel <at> crazy-compilers.com>

Date: Fri, 4 Oct 2019 11:07:01 UTC

Severity: normal

Tags: patch

Done: Hartmut Goebel <h.goebel <at> crazy-compilers.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 37617 in the body.
You can then email your comments to 37617 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#37617; Package guix-patches. (Fri, 04 Oct 2019 11:07:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Hartmut Goebel <h.goebel <at> crazy-compilers.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Fri, 04 Oct 2019 11:07:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
To: guix-patches <at> gnu.org
Subject: [PATCH 0/6] Add weasyprint and dependencies.
Date: Fri,  4 Oct 2019 13:06:41 +0200
weasyprint is a document factory for creating PDF files from HTML.

Tested along these lines:

./pre-inst-env guix environment --pure -C --ad-hoc \
    weasyprint python-pytest
cd /gnu/store/*-weasyprint-50/lib/python*/site-*/weasy*
export PYTHONPATH=$(echo /gnu/store/*-profile*/lib/python*/site-*/)
pytest tests/ -k 'not test_flex_column_wrap_reverse and not test_http'

test_flex_column_wrap_reverse is deselected in the package description,
test_http has to be deselected since network is missing in the container.


Hartmut Goebel (6):
  gnu: Add python-pytest-isort.
  gnu: Add python-tinycss2.
  gnu: Add python-cssselect2.
  gnu: Add python-cairosvg.
  gnu: Add python-pyphen.
  gnu: Add weasyprint.

 gnu/packages/pdf.scm          | 81 +++++++++++++++++++++++++++++++++++
 gnu/packages/python-check.scm | 31 ++++++++++++++
 gnu/packages/python-web.scm   | 69 ++++++++++++++++++++++++++++-
 gnu/packages/python-xyz.scm   | 54 +++++++++++++++++++++++
 4 files changed, 234 insertions(+), 1 deletion(-)

-- 
2.21.0





Information forwarded to guix-patches <at> gnu.org:
bug#37617; Package guix-patches. (Fri, 04 Oct 2019 11:09:01 GMT) Full text and rfc822 format available.

Message #8 received at 37617 <at> debbugs.gnu.org (full text, mbox):

From: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
To: 37617 <at> debbugs.gnu.org
Subject: [PATCH 3/6] gnu: Add python-cssselect2.
Date: Fri,  4 Oct 2019 13:08:21 +0200
* gnu/packages/python-web.scm (python-cssselect2): New variable.
---
 gnu/packages/python-web.scm | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index 576b75175d..0946a298a9 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -3309,3 +3309,36 @@ grammar of CSS but doesn’t know specific rules, properties or values supported
 in various CSS modules.")
     (license license:bsd-3)))
 
+(define-public python-cssselect2
+  (package
+    (name "python-cssselect2")
+    (version "0.2.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "cssselect2" version))
+       (sha256
+        (base32 "0skymzb4ncrm2zdsy80f53vi0arf776lvbp51hzh4ayp1il5lj3h"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _ (invoke "pytest"))))))
+    (propagated-inputs
+     `(("python-tinycss2" ,python-tinycss2)))
+    (native-inputs
+     `(("python-pytest-cov" ,python-pytest-cov)
+       ("python-pytest-flake8" ,python-pytest-flake8)
+       ("python-pytest-isort" ,python-pytest-isort)
+       ("python-pytest-runner" ,python-pytest-runner)))
+    (home-page "https://cssselect2.readthedocs.io/")
+    (synopsis "CSS selectors for Python ElementTree")
+    (description "@code{cssselect2} is a straightforward implementation of
+CSS3 Selectors for markup documents (HTML, XML, etc.) that can be read by
+ElementTree-like parsers (including cElementTree, lxml, html5lib, etc.).
+
+Unlike the Python package @code{cssselect}, it does not translate selectors to
+XPath and therefore does not have all the correctness corner cases that are
+hard or impossible to fix in cssselect.")
+    (license license:bsd-3)))
-- 
2.21.0





Information forwarded to guix-patches <at> gnu.org:
bug#37617; Package guix-patches. (Fri, 04 Oct 2019 11:09:02 GMT) Full text and rfc822 format available.

Message #11 received at 37617 <at> debbugs.gnu.org (full text, mbox):

From: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
To: 37617 <at> debbugs.gnu.org
Subject: [PATCH 5/6] gnu: Add python-pyphen.
Date: Fri,  4 Oct 2019 13:08:23 +0200
* gnu/packages/python-xyz.scm (python-pyphen): New variable.
---
 gnu/packages/python-xyz.scm | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index abcd7e7408..c7ffecabbf 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -16509,3 +16509,22 @@ SVG parser, trying to follow the SVG 1.1 recommendation from the W3C.  Once
 parsed, the result is drawn to a Cairo surface that can be exported to
 qvarious formats: PDF, PostScript, PNG and even SVG.")
     (license license:lgpl3+)))
+
+(define-public python-pyphen
+  (package
+    (name "python-pyphen")
+    (version "0.9.5")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "Pyphen" version))
+       (sha256
+        (base32 "08c9y69ry9d6m4zalhnalg86lsp9v2j5n1ziw5vxfmiihx83lqrv"))))
+    (build-system python-build-system)
+    ;; TODO: Use the Guix system hyphenation packages hyphen-* rather than the
+    ;; embedded set provided by upstream - like Debian does.
+    (home-page "https://github.com/Kozea/Pyphen")
+    (synopsis "Pure Python module to hyphenate text")
+    (description "Pyphen is a pure Python module to hyphenate text using
+existing Hunspell hyphenation dictionaries.")
+    (license (list license:gpl2 license:lgpl2.1 license:mpl1.1))))
-- 
2.21.0





Information forwarded to guix-patches <at> gnu.org:
bug#37617; Package guix-patches. (Fri, 04 Oct 2019 11:09:02 GMT) Full text and rfc822 format available.

Message #14 received at 37617 <at> debbugs.gnu.org (full text, mbox):

From: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
To: 37617 <at> debbugs.gnu.org
Subject: [PATCH 2/6] gnu: Add python-tinycss2.
Date: Fri,  4 Oct 2019 13:08:20 +0200
* gnu/packages/python-web.scm (python-tinycss2): New variable.
---
 gnu/packages/python-web.scm | 36 +++++++++++++++++++++++++++++++++++-
 1 file changed, 35 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/python-web.scm b/gnu/packages/python-web.scm
index e37ae94e18..576b75175d 100644
--- a/gnu/packages/python-web.scm
+++ b/gnu/packages/python-web.scm
@@ -13,7 +13,7 @@
 ;;; Copyright © 2014, 2015 Mark H Weaver <mhw <at> netris.org>
 ;;; Copyright © 2015 Cyril Roelandt <tipecaml <at> gmail.com>
 ;;; Copyright © 2015, 2016, 2017, 2019 Leo Famulari <leo <at> famulari.name>
-;;; Copyright © 2016 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
+;;; Copyright © 2016, 2019 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
 ;;; Copyright © 2016, 2017, 2018, 2019 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2015, 2017 Ben Woodcroft <donttrustben <at> gmail.com>
 ;;; Copyright © 2015, 2016 Christopher Allan Webber <cwebber <at> dustycloud.org>
@@ -62,6 +62,7 @@
   #:use-module (gnu packages libffi)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-check)
   #:use-module (gnu packages python-crypto)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages sphinx)
@@ -3275,3 +3276,36 @@ library to create slugs from unicode strings while keeping it DRY.")
     (description "Generate complex HTML+JS pages with Python")
     (license license:expat)))
 
+(define-public python-tinycss2
+  (package
+    (name "python-tinycss2")
+    (version "1.0.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "tinycss2" version))
+       (sha256
+        (base32 "1kw84y09lggji4krkc58jyhsfj31w8npwhznr7lf19d0zbix09v4"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _ (invoke "pytest"))))))
+    (propagated-inputs
+     `(("python-webencodings" ,python-webencodings)))
+    (native-inputs
+     `(("python-pytest-flake8" ,python-pytest-flake8)
+       ("python-pytest-isort" ,python-pytest-isort)
+       ("python-pytest-runner" ,python-pytest-runner)))
+    (home-page "https://tinycss2.readthedocs.io/")
+    (synopsis "Low-level CSS parser for Python")
+    (description "@code{tinycss2} can parse strings, return Python objects
+representing tokens and blocks, and generate CSS strings corresponding to
+these objects.
+
+Based on the CSS Syntax Level 3 specification, @code{tinycss2} knows the
+grammar of CSS but doesn’t know specific rules, properties or values supported
+in various CSS modules.")
+    (license license:bsd-3)))
+
-- 
2.21.0





Information forwarded to guix-patches <at> gnu.org:
bug#37617; Package guix-patches. (Fri, 04 Oct 2019 11:09:03 GMT) Full text and rfc822 format available.

Message #17 received at 37617 <at> debbugs.gnu.org (full text, mbox):

From: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
To: 37617 <at> debbugs.gnu.org
Subject: [PATCH 4/6] gnu: Add python-cairosvg.
Date: Fri,  4 Oct 2019 13:08:22 +0200
* gnu/packages/python-xyz.scm (python-cairosvg): New variable.
---
 gnu/packages/python-xyz.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 413d68c258..abcd7e7408 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -16474,3 +16474,38 @@ It is the recommended replacement for Python's original
 @code{distro} also provides a command-line interface to output the platform
 information in various formats.")
     (license license:asl2.0)))
+
+(define-public python-cairosvg
+  (package
+    (name "python-cairosvg")
+    (version "2.4.2")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "CairoSVG" version))
+       (sha256
+        (base32 "1bb7irxbaxxb9ahm3z5wsx1q96mm5gzskc7b6q07h9ikcnb8yrjf"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _ (invoke "pytest"))))))
+    (propagated-inputs
+     `(("python-cairocffi" ,python-cairocffi)
+       ("python-cssselect2" ,python-cssselect2)
+       ("python-defusedxml" ,python-defusedxml)
+       ("python-pillow" ,python-pillow)
+       ("python-tinycss2" ,python-tinycss2)))
+    (native-inputs
+     `(("python-pytest-flake8" ,python-pytest-flake8)
+       ("python-pytest-isort" ,python-pytest-isort)
+       ("python-pytest-runner" ,python-pytest-runner)))
+    (home-page "https://cairosvg.org/")
+    (synopsis "SVG to PDF/PS/PNG converter based on Cairo")
+    (description "CairoSVG is a SVG converter based on Cairo.  It can export
+SVG files to PDF, PostScript and PNG files.  The main part of CairoSVG is a
+SVG parser, trying to follow the SVG 1.1 recommendation from the W3C.  Once
+parsed, the result is drawn to a Cairo surface that can be exported to
+qvarious formats: PDF, PostScript, PNG and even SVG.")
+    (license license:lgpl3+)))
-- 
2.21.0





Information forwarded to guix-patches <at> gnu.org:
bug#37617; Package guix-patches. (Fri, 04 Oct 2019 11:09:03 GMT) Full text and rfc822 format available.

Message #20 received at 37617 <at> debbugs.gnu.org (full text, mbox):

From: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
To: 37617 <at> debbugs.gnu.org
Subject: [PATCH 6/6] gnu: Add weasyprint.
Date: Fri,  4 Oct 2019 13:08:24 +0200
* gnu/packages/pdf.scm (weasyprint): New variable.
---
 gnu/packages/pdf.scm | 81 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)

diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
index 9c7cc0b7d2..e0310ac89e 100644
--- a/gnu/packages/pdf.scm
+++ b/gnu/packages/pdf.scm
@@ -15,6 +15,7 @@
 ;;; Copyright © 2017, 2018 Rene Saavedra <pacoon <at> protonmail.com>
 ;;; Copyright © 2017, 2018, 2019 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2019 Alex Griffin <a <at> ajgrf.com>
+;;; Copyright © 2019 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -65,6 +66,7 @@
   #:use-module (gnu packages imagemagick)
   #:use-module (gnu packages javascript)
   #:use-module (gnu packages lesstif)
+  #:use-module (gnu packages libffi)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages lua)
   #:use-module (gnu packages pcre)
@@ -72,6 +74,8 @@
   #:use-module (gnu packages photo)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-check)
+  #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
   #:use-module (gnu packages sdl)
@@ -1158,3 +1162,80 @@ manipulating PDF documents from the command line.  It supports
 @item displaying the mapping between logical and physical page numbers
 @end itemize")
     (license license:bsd-3)))
+
+(define-public weasyprint
+  (package
+    (name "weasyprint")
+    (version "50")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "WeasyPrint" version))
+       (sha256
+        (base32 "0invs96zvmcr6wh5klj52jrcnr9qg150v9wpmbhcsf3vv1d1hbcw"))
+       (patches (search-patches "weasyprint-library-paths.patch"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-library-paths
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((fontconfig (assoc-ref inputs "fontconfig"))
+                   (glib (assoc-ref inputs "glib"))
+                   (pango (assoc-ref inputs "pango"))
+                   (pangoft2 (assoc-ref inputs "pangoft2")))
+               (substitute* "weasyprint/fonts.py"
+                 (("@fontconfig@")
+                  (string-append fontconfig "/lib/libfontconfig.so"))
+                 (("@pangoft2@")
+                  (string-append pango "/lib/libpangoft2-1.0.so")))
+               (substitute* "weasyprint/text.py"
+                 (("@gobject@")
+                  (string-append glib "/lib/libgobject-2.0.so"))
+                 (("@pango@")
+                  (string-append pango "/lib/libpango-1.0.so"))
+                 (("@pangocairo@")
+                  (string-append pango "/lib/libpangocairo-1.0.so"))))))
+         (add-after 'unpack 'remove-pytest-options
+           (lambda _
+             (substitute* "setup.cfg"
+               ;; flake8 and isort syntax checks fail, which is not our
+               ;; business
+               (("addopts = --flake8 --isort") ""))))
+         (replace 'check
+           (lambda _
+             ;; run pytest, excluding one failing test
+             (invoke "pytest" "-k" "not test_flex_column_wrap_reverse"))))))
+    (inputs
+     `(("fontconfig" ,fontconfig)
+       ("glib" ,glib)
+       ("pango" ,pango)))
+    (propagated-inputs
+     `(("gdk-pixbuf" ,gdk-pixbuf)
+       ("python-cairocffi" ,python-cairocffi)
+       ("python-cairosvg" ,python-cairosvg)
+       ("python-cffi" ,python-cffi)
+       ("python-cssselect2" ,python-cssselect2)
+       ("python-html5lib" ,python-html5lib)
+       ("python-pyphen" ,python-pyphen)
+       ("python-tinycss2" ,python-tinycss2)))
+    (native-inputs
+     `(("python-pytest-cov" ,python-pytest-cov)
+       ("python-pytest-runner" ,python-pytest-runner)))
+    (home-page "https://weasyprint.org/")
+    (synopsis "Document factory for creating PDF files from HTML")
+    (description "WeasyPrint helps web developers to create PDF documents.  It
+turns simple HTML pages into gorgeous statistical reports, invoices, tickets,
+etc.
+
+From a technical point of view, WeasyPrint is a visual rendering engine for
+HTML and CSS that can export to PDF and PNG.  It aims to support web standards
+for printing.
+
+It is based on various libraries but not on a full rendering engine like
+WebKit or Gecko.  The CSS layout engine is written in Python, designed for
+pagination, and meant to be easy to hack on.  Weasyprint can also be used as a
+python library.
+
+Keywords: html2pdf, htmltopdf")
+    (license license:bsd-3)))
-- 
2.21.0





Information forwarded to guix-patches <at> gnu.org:
bug#37617; Package guix-patches. (Fri, 04 Oct 2019 11:10:02 GMT) Full text and rfc822 format available.

Message #23 received at 37617 <at> debbugs.gnu.org (full text, mbox):

From: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
To: 37617 <at> debbugs.gnu.org
Subject: [PATCH 1/6] gnu: Add python-pytest-isort.
Date: Fri,  4 Oct 2019 13:08:19 +0200
* gnu/packages/python-check.scm (python-pytest-isort): New variable.
---
 gnu/packages/python-check.scm | 31 +++++++++++++++++++++++++++++++
 1 file changed, 31 insertions(+)

diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm
index b8aaef9b77..362f548c02 100644
--- a/gnu/packages/python-check.scm
+++ b/gnu/packages/python-check.scm
@@ -3,6 +3,7 @@
 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me <at> tobias.gr>
 ;;; Copyright © 2019 Efraim Flashner <efraim <at> flashner.co.il>
 ;;; Copyright © 2019 Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
+;;; Copyright © 2019 Hartmut Goebel <h.goebel <at> crazy-compilers.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -153,6 +154,36 @@ of the project to ensure it renders properly.")
 compliance.")
     (license license:bsd-3)))
 
+(define-public python-pytest-isort
+  (package
+    (name "python-pytest-isort")
+    (version "0.3.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "pytest-isort" version))
+       (sha256
+        (base32 "06myn5hhxs5yp8dqr1yjsgcnnxnsrvsqannm00bvaw0qml6ydzjb"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _
+             (setenv "PYTHONPATH"
+                     (string-append (getcwd) ":"
+                                    (getenv "PYTHONPATH")))
+             (invoke "pytest"))))))
+    (propagated-inputs
+     `(("python-isort" ,python-isort)
+       ("python-pytest" ,python-pytest)))
+    (home-page "https://github.com/moccu/pytest-isort/")
+    (synopsis "Pytest plugin to check import ordering using isort")
+    (description
+     "This package provides a pytest plugin to check import ordering using
+isort.")
+    (license license:bsd-3)))
+
 (define-public python-pytest-shutil
   (package
     (name "python-pytest-shutil")
-- 
2.21.0





Reply sent to Hartmut Goebel <h.goebel <at> crazy-compilers.com>:
You have taken responsibility. (Tue, 22 Oct 2019 15:03:01 GMT) Full text and rfc822 format available.

Notification sent to Hartmut Goebel <h.goebel <at> crazy-compilers.com>:
bug acknowledged by developer. (Tue, 22 Oct 2019 15:03:02 GMT) Full text and rfc822 format available.

Message #28 received at 37617-close <at> debbugs.gnu.org (full text, mbox):

From: Hartmut Goebel <h.goebel <at> crazy-compilers.com>
To: 37617-close <at> debbugs.gnu.org
Subject: Re: bug#37617: Acknowledgement ([PATCH 0/6] Add weasyprint and
 dependencies.)
Date: Tue, 22 Oct 2019 17:02:22 +0200
Commited as 73f0ed8dbfde97341716fd8b156907e4ef800873

-- 
Regards
Hartmut Goebel

| Hartmut Goebel          | h.goebel <at> crazy-compilers.com               |
| www.crazy-compilers.com | compilers which you thought are impossible |





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 20 Nov 2019 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 206 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.